2

I want to write the copyright symbol to the footer of a pdf file. The octal code \251 only works when the encoding of the file is latin. (english language) when the output pdf is in chinese, japanese, korean language. The symbol is printed totally different. I already know that the output file has GB2312 encoding and the code for copyright symbol is two byte character \0xAAC2 .

I've been trying to find out how I should print it? Do I have to convert it to utf16 prior to sprintf ing?

user
  • 86,916
  • 18
  • 197
  • 190
azi
  • 21
  • 1
  • It's quite possible that the symbol isn't part of that character set. I haven't been able to find it in a couple of different references. Are you absolutely sure the code should be 0xAAC2? – Mark Ransom Aug 15 '12 at 01:06
  • Try taking a sample from a native Chinese text editor (i.e.: not Unicode aware) that can save file in any CJK encoding (not ANSI nor UTF; preferably GB2312 or Big5). Use it to make a copyright character via Character Map or similar program, then save it to a file without any formatting if possile. Finally view the file in a hex editor. – Jay Aug 16 '12 at 03:15
  • @MarkRansom I got the code from the table [here](http://ash.jp/code/cn/gb2312tbl.htm) – azi Aug 17 '12 at 01:19
  • 1
    When I go to that page it tells me the character for AAC2 is U+E022, which doesn't appear to be a valid unicode character. I can't find a copyright symbol anywhere on the page. – Mark Ransom Aug 17 '12 at 02:39

1 Answers1

0

If you are using sprintf I think you can do:

unsigned char one = 0xAA;
unsigned char two = 0xC2;
char output_line[20];
sprintf(output_line,"%c%c",one,two);

or, as suggested below:

sprintf(output_line,"\xaa\xc2");
Scooter
  • 6,802
  • 8
  • 41
  • 64