Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

check the character whether is unicode.

Former Member
0 Kudos
406

hi,

there's a string ,it contains characters , some is unicode and another isn't .

how can i judge it ?

5 REPLIES 5

Former Member
0 Kudos
135

Hi Mei,

I don't think it is possible. Either it is Unicode or No-Unicode, you can not have a mixed string. Can you elaborate more on your problem ?

Cheers,

Sanjeev

0 Kudos
135

To me ,the question is shown below,

I have a string , it's too loog to fit the width, then

I have to show it in many rows,I use an fixed length ,for example 10 .To the unicode character, the amount is 5. but if there's a common character ,e.g. A, in the string,an unicode character will be truncated, so I can't show the string correctly, Then I need to distinct the characters.

Former Member
0 Kudos
135

Hi, you can try to convert the string to xstring or binary format. Then compare every character as a Hex value.

I remember there are some characteristics in the Unicode , which combine two byte as a char, and the first of the byte should has a rule on it. But I can't remember clearly the details of the rule.

It's a suggestion, you should do further research on the protocol of Unicode.

Hope it will be helpful.

Message was edited by: zhenglin gu

Former Member
0 Kudos
135

Hi, I understand your problem, and have met the same prolbem.

You should check every char from the tail of the string, compare if a byte is bigger than 7F(maybe this value, you can find some material on network), if so, it means this is the first byte of a DBCS(Double-Byte Character Set), if not, you should check next byte before it, if still not, the this one is a single char, if the front one is more than 7F, than this is the second byte of a DBCS.

According to this logic, then you can calculate out if the position you want to split is belong to a DBCS or not, then you can choose the proper action to split it.

Hope it will be helpful.

By the way, I achieve it by this logic, but don't know if there is any exists standard FM can do this.

Thanks

Message was edited by: zhenglin gu

Former Member
0 Kudos
135

Can somebody give me an sample on the problem? thanks