> > nameH = MemHandleNew(dlkMaxUserNameLength + 1); >> >> If Japanese Chars are two bytes in length, wouldn't this reserve only half > > > as much space as is required? > >I don't think so. I suspect the buffer size is the same on Japanese as it is >on Latin devices. This means that you can only enter about half as many >characters. That's how the Find dialog works.
Danny is correct. Buffer sizes and string lengths in Palm OS are _always_ in terms of bytes, not characters. As Danny also noted, Shift-JIS is a mixed size encoding, where a character occupies one or two bytes in a string. Chinese is the same. UTF-8 takes one to four bytes per character. Use the Text Mgr as much as possible to isolate your code from the underlying representation of characters in strings. A side note - Unfortunately the Palm APIs are pretty sloppy with their naming conventions for buffer limits. Ideally anything called xxxLen[gth] would be the length of a string, excluding the terminating null, and anything called xxxSize would _include_ space for the terminating null, but that's not the case currently, so be careful. -- Ken -- Ken Krugler TransPac Software, Inc. <http://www.transpac.com> +1 530-470-9200 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
