-1

what i am trying to do is converting Unicode decimal code into character and save it in the oracle database by using following code

uni_code= 131;
decoded_character_ := decoded_character_ || chr(uni_code using NCHAR_CS);

this work fine for Unicode decimal code 1 to 127 but after that oracle database save some random character. (i'm not sure those are random or do those character a have a reason ) Is this happen because i'm doing this wrong ? thank you in advance

Edited: after further investigation i found that oracle cannot concatenate Unicode character less than 127 and more than 127 . as example

select chr(131) || chr(66) from dual;

this out put only 'B'.

any reason for that ?

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
sachith95
  • 3
  • 1
  • 5

1 Answers1

0

For me it is not clear what you are looking for but here are several possibilities:

SELECT 
    UNISTR('\00E9'),
    CHR(233 USING NCHAR_CS), 
    CHR(50089),
    UTL_I18N.RAW_TO_CHAR(HEXTORAW('C3A9'), 'AL32UTF8'),
    UTL_I18N.RAW_TO_CHAR(HEXTORAW('00E9'), 'AL16UTF16'),
    UTL_I18N.RAW_TO_CHAR(TO_CHAR(130, 'fmXX'), 'US8PC437'),
    UTL_I18N.RAW_TO_CHAR(TO_CHAR(233, 'fmXX'), 'WE8MSWIN1252')
from dual;

See https://codepoints.net/U+00E9 or https://unicode-table.com/en/00E9/ to get all numbers for é

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • sorry for confusing , i was trying to do create a encryption logic , in that case my code create a ASCII code by itself by adidnd some values. so sometime this ASCII code value exceed 127(Extended ASCII code) .so in that case , when i try to concatenate that with normal ASCII character with Extended ASCII character oracle fails . – sachith95 Aug 02 '18 at 08:21
  • What do you mean by "Extended ASCII code"? There are dozens of extensions for ASCII (Wikipedia states about 220 extensions). – Wernfried Domscheit Aug 02 '18 at 08:27
  • what i mean by extended ASCII is this http://www.wendag.com/Computer/ascii_code.html – sachith95 Aug 02 '18 at 08:30
  • This table is wrong! ISO 8859-1 does not contain the `€` currency symbol. And where do you think you use ISO 8859-1? See https://stackoverflow.com/questions/700187/unicode-utf-ascii-ansi-format-differences or https://stackoverflow.com/questions/7048745/what-is-the-difference-between-utf-8-and-iso-8859-1. – Wernfried Domscheit Aug 02 '18 at 08:40
  • When you use `USING NCHAR_CS` then you refer to NLS_NCHAR_CHARACTERSET, i.e. in your case `AL16UTF16` (aka UTF-16). However codepoint 135 (or 0087hex) is [U+0087 END OF SELECTED AREA](https://codepoints.net/U+0087), i.e. a non-printable character. – Wernfried Domscheit Aug 02 '18 at 09:17