2

I am having to store sequences of Japanese names written in the Shift-JIS format that are scooped from the internet. I am thinking for storing them in character arrays and writing them to a file with something like:

fprintf(fp,"The name is [%s]\n",string_array);

My only concern is that if Shift-JIS characters may include '\0' then this will obviously break... but I'm not sure if Shift-JIS ever does. Unfortunately it seems Shift-JIS is such an arcane system that I can barely comprehend the definitions of the system I've found online with enough confidence to answer the question myself.

Mick
  • 8,284
  • 22
  • 81
  • 173

1 Answers1

2

Looking at Wikipedia's Shift-JIS byte map, the byte values 0x00-0x3F are not used as second bytes (and nor are 0x7F or 0xFD-0xFF), so you're fine interpreting '\0' as a null terminator.

ecatmur
  • 152,476
  • 27
  • 293
  • 366