最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sql - Unicode with special character return octal number - Stack Overflow

programmeradmin2浏览0评论

I am using OCI in C. I execute a SELECT query and got a char string contains special german character.

Using SQL Development I have for example the string "Ich habe vier Äpfel" with VARCHAR2(45). Database has charset AL16UTF16 and WE8ISO8859P15.

After SELECT statement in C I got the string "Ich habe vier \304pfel", after a little search in ASCII page, \304 is octal number for the German character "Ä". But I am wondering, why it gets an octal number instead of hex number. Could you tell me, if I can change a setting or something else to get a hex number instead of octal number of the character?

I am using OCI in C. I execute a SELECT query and got a char string contains special german character.

Using SQL Development I have for example the string "Ich habe vier Äpfel" with VARCHAR2(45). Database has charset AL16UTF16 and WE8ISO8859P15.

After SELECT statement in C I got the string "Ich habe vier \304pfel", after a little search in ASCII page, \304 is octal number for the German character "Ä". But I am wondering, why it gets an octal number instead of hex number. Could you tell me, if I can change a setting or something else to get a hex number instead of octal number of the character?

Share Improve this question edited Feb 8 at 3:36 Dale K 27.2k15 gold badges56 silver badges82 bronze badges asked Feb 7 at 19:05 king558king558 212 bronze badges 2
  • varchar2 means Oracle, right? – jarlh Commented Feb 7 at 20:39
  • Where precisely do you get the backslash? In your terminal, in a file where you output it and that you edited with vi, or in memory just after the call? What does strlen(the returned string) return? – Guillaume Outters Commented Feb 8 at 8:59
Add a comment  | 

1 Answer 1

Reset to default 1

C uses octal (\nnn) as a default for escape sequences for characters with values beyond the basic ASCII range. This is part of the C standard. If you want a hexadecimal representation, you have to explicitly format it.

发布评论

评论列表(0)

  1. 暂无评论