1. Swarnendu Das
  2. PowerBuilder
  3. Friday, 18 October 2019 19:47 PM UTC

After converting my application from PowerBuilder 9 to PowerBuilder 17 all of a sudden certain comments are appearing in Chinese. 

I have used SELECTBLOB to fetch the data and converted it to string. 

The column "comnt" is declared as a BLOB in Oracle

The resolution I found is to use the utility utl_raw.cast_to_varchar2(dbms_lob.substr(d.comnt)) to convert the blob data to varchar2 directly in Oracle.

This works but after going through some articles it looks like it will convert first 32767 characters. What if the comment entered by user is more than that?

For now I am good but please let me know if there is any better solution. Any help would be appreciated.

 

Thanks

Shawn.

Roland Smith Accepted Answer Pending Moderation
  1. Friday, 18 October 2019 20:13 PM UTC
  2. PowerBuilder
  3. # 1

PB9 uses Ansi (single byte) strings while PB10 and higher use Unicode (double byte) strings.

You've got Ansi strings stored in the database as a blob. To convert it to Unicode, change it to:

lsComments = string(lbComments, EncodingAnsi!)

 

Any new data will be in Unicode so you'll need to specify EncodingAnsi when converting from string to blob before the UpdateBlob statement.

Comment
  1. Swarnendu Das
  2. Monday, 21 October 2019 16:09 PM UTC
Hello Ron, thank you so much! this works :)

I didn't know String function has a overload where we can send the Encoding.



These is really wonderful!!



Thanks

Swarnendu.
  1. Helpful
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.