c - Why are these Unicode characters not printed although I set my environment to UTF8? -


how print unicode characters? although set utf-8 encoding, i'm not able print it. getting unicode characters in hex (c2 82 c2 81 c2 80 0) in continuous stream of bytes. when tried print unicode character pointing character pointer @ beginning, it's not printing. why?

   char s[]={0xc2,0x82,0xc2,0x81,0xc2,0x80,0x00};    printf("%s",s); 

using c in linux environment.

you won't see if terminal configured work utf-8 because characters 'displaying' are:

0xc2 0x82 = u+0082 0xc2 0x81 = u+0081 0xc2 0x80 = u+0080 

these control-characters c1 set. have data file documents:

# c1 controls (0x80 - 0x9f) iso/iec 6429:1992 # not define names 80, 81, or 99.  80 u+0080 81 u+0081 82 u+0082 bph break permitted here 

so don't see because aren't displaying graphic characters. if change 0x82 0xa2, example (and 0x81 0xa1, , 0x80 0xa0), you'll more visible output:

0xc2 0xa2 = u+00a2 0xc2 0xa1 = u+00a1 0xc2 0xa0 = u+00a0  a0 u+00a0 no-break space a1 u+00a1 inverted exclamation mark a2 u+00a2 cent sign  $ ./x ¢¡  $ 

and if you're good, can see no-break space after inverted exclamation mark¡


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -