[NTG-context] Problem with \doifelse testing of UTF-8 chars

Taco Hoekwater taco at elvenkind.com
Thu Apr 22 21:33:17 CEST 2010

Jaroslav Hajtmar wrote:
> Hello,
> I have problem with testing of strings through \doifelse.
> I am loading data from external CSV file. CSV file is UTF-8 encoding.
> Data from external file I am reading to ConTeXt macro and I want compare 
> content of macro (it is one utf-8 character) and other character as per 
> example:
> (\onecharfromcsvfile contains one character from external CSV file)

Does it contain a character or a byte from the CSV? This is a
very important difference.

> % I compare e.g. "m" character and content of macro  \onecharfromcsvfile
> \def\result{\doifelse{m}{\onecharfromcsvfile}{true}{false} }
> \result is however always false

Well, that depends on whether m's in your csv file, and how 
\onecharfromcvsfile is actually defined. This reports true:

\def\result{\doifelse{m}{\onecharfromcsvfile}{true}{false} }

Best wishes,

More information about the ntg-context mailing list