on 12-03-2014 4:50 AM
I am getting a string from an external source (not a text file) that sends text as Ascii with Unicode characters encoded like this:
U+C218U+C815U+AC74
I need a method to convert this to the Unicode encoding format used by normal PowerBuilder string variables.
Thanks
Hi Roland,
it looks like "Unicode U+hex notation". Unicode code converter
Here is a native2ascii converter: Native-to-ASCII Converter (Online: Interactive native2ascii)
Maybe this Java code can help you to write your own converter: ASCII 2 NATIVE : Code Unicode « Development Class «&...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Already have them, thanks.
Here is what I came up with:
String ls_comment, ls_code, ls_char
Long ll_pos, ll_char
ls_comment = "Some regular text with U+C218U+C815U+AC74 embedded unicode."
ll_pos = Pos(ls_comment, "U+")
Do While ll_pos > 0
ls_code = Mid(ls_comment, ll_pos + 2, 4)
ll_char = of_Hex2Nbr(ls_code)
ls_char = String(Char(ll_char))
ls_comment = Replace(ls_comment, ll_pos, 6, ls_char)
ll_pos = Pos(ls_comment, "U+", ll_pos)
Loop
MessageBox("Comment", ls_comment)
Hi Andre;
You can just download the framework and then extract those global functions. There are many others that might interest you as well. The framework is free to use or borrow code from.
FYI: http://sourceforge.net/projects/stdfndclass/
Regards ... Chris
PS: Let me know if you cannot access SourceForge.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.