This discussion is archived
4 Replies Latest reply: Aug 21, 2012 10:28 PM by Duncan Gardner RSS

What is the reverse of UNISTR?

Duncan Gardner Newbie
Currently Being Moderated
How do I convert unicode characters into a unicode string? I thought it might be utl_raw.cast_to_raw, but that doesn't work consistently - I get a a six-character HEX string, expecting four for charcacers I enter via a SQL statement.

SELECT x, utl_raw.cast_to_raw(x), y, utl_raw.cast_to_raw(y)
FROM (SELECT UNISTR('\4E2D') as x, '中' AS y FROM DUAL);

results in:

"X" "UTL_RAW.CAST_TO_RAW(X)" "Y" "UTL_RAW.CAST_TO_RAW(Y)"
"中" "4E2D" "中" "E4B8AD"

My database is AL32UTF8. I'm using SQL Developer, with NLS_LANG set to ENGLISH_AUSTRALIA.AL32UTF8. My Windows 7 environment is English Australia.

I suspect it is some sort of client issue. Can I resolve this without changing my PC to the target language in it's entirety?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points