handling the UTF 8 characters in apex

Viewed 14

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),' '),chr(10),'
');

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.

0 Answers
Related