Running the Gremlins on my application, I get a "TextMgr.cpp, Line:727, Sign-extended char passed to TxtCharAttr" warning because the Gremlin wrote a 236 (EC) character into a field onto which I later perform, for each character, a TxtGlueCharIsAlNum call, which in turn, calls TxtCharAttr. The OS reference about TxtCharAttr says "The character passed to this function must be a valid character given the system encoding.". Yet, in the Latin character set, this 236 character is simply an accented lowercase "a". Isn't this a valid character?
Yes.
What kind of preventive filtering must I perform before calling TxtGlueCharIsAlNum to prevent this? I already call this API to know whether the char is a letter...
I'm guessing that you're grabbing the characters from the text field using a Char variable (or Char*). When you pass a Char to a routine that expects a WChar, the 8-bit Char gets sign-extended, and thus the character code 236 (0xEC) becomes 0xFFEC.
So either you want to use TxtGetNextChar to pull WChar values out of a string (bonus - this will also help your code work correctly with Japanese, Chinese, and the UTF-8 Unicode encoding), or you need to do proper type-casting to prevent the sign extension from occurring.
-- 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/
