• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

char c = �\ucafe�;

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Fellows
Is anybody could explain me how this is represent char in Unicode notation?
char c = �\ucafe�;
I am confused because until now I�ve seen only �\u0022�, �\u0xAD�, etc.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unicode escapes use hexadecimal notation, using digits 0-9 and letters a-f (or A-f). As it happens, c, a, f, and e are all hex digits. So "cafe" is a hexadecimal number, which evaluates to 51966. In unicode this is assigned to a Hangul (Korean) character, 쫾. If you don't have the font installed for that - well, trust me; it's a Korean character.
 
Aleksandar Stojanovic
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jim Yingst

but I thought that hexadecimal representation must have 0x before any character or number.
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are a couple different formats here. Unicode escapes look like \u0010, \u00FF, or \ucafe. No X. Escape sequences for character and string literals include octal escapes, which look like \12 or \377, still no X, and use octal rather than hex. Integer literals look like 45, 071, or 0x3FF. These can be in decimal, hex or octal, so the "0" and "0x" (or "0X") are needed to tell which is used. Note that when you use these, there's no \ or u.
 
Aleksandar Stojanovic
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Jim
 
reply
    Bookmark Topic Watch Topic
  • New Topic