1. Andreas Steinhauser
  2. PowerBuilder
  3. Wednesday, 22 January 2020 12:41 PM UTC

Hi,

we are currently using Powerbuilder 2017/R3 Build 1858. We have an issue regarding UTF8 character encoding. We have to send a string UTF8 encoded to an external software (function is called directly in Powerbuilder).

Problem with eg. special german letters (ü,ä, …)

If there is such a letter in this string (surname, firstname, …) this string isn’t encoded with correctly with UTF8, irrespective if what I do (because of Powerbuilder uses UFT16LE internally?)

This is my test:

// Test

String ls_in = "ü"

String ls_out

Blob lbl_hex

coderobject lnvo_coderobject

lnvo_coderobject = Create coderobject

 

lbl_hex = Blob(ls_in)

ls_out = lnvo_coderobject.HexEncode(lbl_hex)

MessageBox("UTF16 - FC00", ls_out) // correct hexvalue

 

lbl_hex = Blob(ls_in, EncodingUTF8!)

ls_out = lnvo_coderobject.HexEncode(lbl_hex)

MessageBox("UTF8 - C3B3", ls_out) // correct hexvalue

 

ls_out = String(lbl_hex, EncodingUTF8!)

// Hex: FC00 – wrong hex values (checked it with an external editor)

 Destroy lnvo_coderobject

 

Is there a possibility to convert/create this string with an UTF8 encoding (means HEX: C3B3)?

Thanks,

Andreas

Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 14:28 PM UTC
  2. PowerBuilder
  3. # 1

Hi Andreas,

When I run your test code in PB 2019 R2 #2279 the UFT-8 hex value is C3BC. which is the UTF-8 representation of ü (lowercase U-umlaut).

REF: https://www.compart.com/en/unicode/U+00FC

HTH /Michael

Comment
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 05:23 AM UTC
  2. PowerBuilder
  3. # 2

Hi  Andreas,

 

PB has used Unicode since PB 10.

I suggest you use Unicode in the third party to handle the string passed by PB when it is interacting with the third party. Or you can let the third party receive PB Blob type data.

 

Regards,

Ken

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.