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

Jaroslav Hajtmar hajtmar at gyza.cz
Thu Apr 22 21:55:37 CEST 2010


Hello.
Thank for your advise.
I was tried your example, but it is not working unfortunately too.
I previwed CSV file -  it is UTF-8 encoding and hexa code of "m" 
character is 6D00. This mean that "m" char is byte coding isnt it?
Exist any way untwist my problem now?

Thanx Jaroslav



   In hexa editor is Dne 22.4.2010 21:33, Taco Hoekwater napsal(a):
> 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:
>
> \starttext
> \def\onecharfromcsvfile{m}
> \def\result{\doifelse{m}{\onecharfromcsvfile}{true}{false} }
> \result
> \stoptext
>
>
> Best wishes,
> Taco
>



More information about the ntg-context mailing list