Forum Stats

  • 3,874,219 Users
  • 2,266,685 Discussions
  • 7,911,771 Comments

Discussions

Handling UTF8 characters in APEX

Niki Dilip
Niki Dilip Member Posts: 17 Blue Ribbon

I have created a textarea pageitem. In the textarea, I am pasting a sql query or writing a simple text with space and linebreak . On submit, in the next page , the same needs to be displayed.

As my sql query or the inputted text was getting displayed in same line without linebreak, I used the below code. Which solved the problem.

:P2_NEW := replace(replace(:P2_NEW,CHR(32),'&nbsp;'),chr(10),'<br>');

htp.p(P2_NEW);

But now when i copy the sql and try to run in sql developer, the sql doesnt run, On pasting the sql in notepad ++ and selecting encoding->UTF8, i am seeing that whereever there is space, it is getting replaced as 'xA0' characters Similarly for text which contained ü is replaced by 'xFC'.

What needs to be done so that, the space doesnot get replaced by xA0 and ü by xFC(Please note there are many similar characters that gets replaced with the corresponding UTF8 characters.eg ä)

Please advice.

Thanks & Regards