Tony Stark
Tony Stark

Reputation: 25538

C converts HEX value from emacs into the incorrect value

in a file, i have used m-x ucs-insert to insert a hex character 9e (which in emacs shows up as \236). however, when this is read in by the C program, 9e is becoming 0x9ec2. Where is this c2 coming from and how do i get rid of it??

Upvotes: 2

Views: 223

Answers (1)

psmears
psmears

Reputation: 28000

The unicode character U+009E is represented in UTF-8 as the bytes C2 9E (see this handy converter). It's likely that your emacs is set up to save files in UTF-8. Try loading the file in emacs with M-x find-file-literally and see if it comes out as \302\236 (octal representation of C2 9E). If so, you'll be able to delete the \302 and see if that makes the program run better.

Upvotes: 4

Related Questions