From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/58371 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Problem with \doifelse testing of UTF-8 chars Date: Fri, 23 Apr 2010 18:25:01 +0200 Message-ID: <4BD1C9DD.7000101@wxs.nl> References: <4BD09BFF.3070208@gyza.cz> <4BD0BF67.6070903@wxs.nl> <4BD0CE10.2060601@gyza.cz> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000106020605080809090507" X-Trace: dough.gmane.org 1272040003 23962 80.91.229.12 (23 Apr 2010 16:26:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Apr 2010 16:26:43 +0000 (UTC) Cc: Mojca Miklavec To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Apr 23 18:26:40 2010 connect(): No such file or directory Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O5LiC-0005sa-Bz for gctc-ntg-context-518@m.gmane.org; Fri, 23 Apr 2010 18:26:40 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 10398C9D70; Fri, 23 Apr 2010 18:26:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xeqfx7OZ5zxR; Fri, 23 Apr 2010 18:26:19 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 65207C9D62; Fri, 23 Apr 2010 18:26:12 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id F18E6C9D62 for ; Fri, 23 Apr 2010 18:26:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id V4IhyABMkDA5 for ; Fri, 23 Apr 2010 18:25:49 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (sc-162.r-213-125-29.schoolconnect.nu [213.125.29.162]) by balder.ntg.nl (Postfix) with ESMTP id B4CF0C9D61 for ; Fri, 23 Apr 2010 18:25:49 +0200 (CEST) X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by controller-9 (SurgeMail 4.3e) with ESMTP id 936-1713362 for multiple; Fri, 23 Apr 2010 18:25:33 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:58371 Archived-At: This is a multi-part message in MIME format. --------------000106020605080809090507 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 23-4-2010 2:31, Mojca Miklavec wrote: > On Fri, Apr 23, 2010 at 00:30, Jaroslav Hajtmar wrote: >> Thank you very much. Due to your suggestion it was my problem resolved= . >> Problem has been truly in unexpanded macros. > > Can the solution be applied to the m-database.tex module as well? > > Last time when I tried the UTF-8 didn't work with mkii (if the first > character in cell wasn't an ascii character). > > Mojca > > Example: > > \enableregime[utf-8] > \usemodule[database] > \defineseparatedlist[CSV] > [separator=3Dcomma, > before=3D\bTABLE, after=3D\eTABLE, > first=3D\bTR, last=3D\eTR, > left=3D\bTD, right=3D\eTD] > \starttext > \startCSV > a,b,c,=C4=8D > d,e,f,=C5=A1 > \stopCSV > \stoptext > _______________________________________________________________________= ____________ > If your question is of interest to others as well, please add an entry = to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-= context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _______________________________________________________________________= ____________ --=20 ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- --------------000106020605080809090507 Content-Type: text/x-tex; name="m-database.tex" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="m-database.tex" %D \module %D [ file=m-database, %D version=2006.04.23, %D title=\CONTEXT\ Modules, %D subtitle=Database Thingies, %D author=Hans Hagen\& Taco Hoekwater, %D date=\currentdate, %D copyright=PRAGMA %D ] %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \unprotect % % % to be added to mult-* files % % % % todo: \dontcollectseparatedlist via k/v \definesystemvariable{ls} \def\c!first {first} \def\c!last {last} \def\c!quotechar {quotechar} \let\@NX\noexpand %D {processquotedlist} %D %D An even more general list processing macro is the %D following one: %D %D \starttyping %D \processquotedlist{beginsym}{endsym}{separator}\docommand list %D \stoptyping %D %D This one supports arbitrary open and close symbols as well %D as user defined separators. %D %D \starttyping %D \processquotedlist(){,}{"}\docommand(a=>b=>c=>d) %D \stoptyping \def\processquotedlist#1#2#3#4#5% {\def\csvquotechar{#4}% \edef\doconvertcsvquoteditem#4##1#4##2% {\@NX\ifx##2#3% \let\@NX\next\@NX\doconvertcsvlist \def\@NX\arg{#3}% \edef\@NX\temp{##1}% \@NX\expanded{\@NX#5{\@NX\temp}}% \@NX\else \let\@NX\next\@NX\redoconvertcsvquoteditem \def\@NX\arg{##1\@NX\csvquotechar}% \@NX\fi \@NX\expandafter\@NX\next\@NX\arg}% \edef\redoconvertcsvquoteditem##1#4##2% {\@NX\ifx##2#3% \let\@NX\next\@NX\doconvertcsvlist \def\@NX\arg{#3}% \edef\@NX\temp{##1}% \@NX\expanded{\@NX#5{\@NX\temp}}% \@NX\else \let\@NX\next\@NX\redoconvertcsvquoteditem \def\@NX\arg{##1\@NX\csvquotechar}% \@NX\fi \@NX\expandafter\@NX\next\@NX\arg}% \edef\doconvertcsvitem##1#3% {\edef\@NX\temp{##1}% \@NX\expanded{\@NX#5{\@NX\temp}}% \@NX\doconvertcsvlist#3}% \edef\doconvertcsvlist#3##1% {\@NX\ifx##1\@NX#2% \let\@NX\next \@NX\gobbleoneargument \@NX\else\@NX\ifx##1#4% \let\@NX\next \@NX\doconvertcsvquoteditem \@NX\else \let\@NX\next \@NX\doconvertcsvitem \@NX\fi\@NX\fi \@NX\next##1}% \doconvertcsvitem} \gdef\doprocessseparatedquoteditem#1% {\appendseparatedlistparameter\c!left% \appendseparatedlistcontent{#1}% \appendseparatedlistparameter\c!right} % % % so far % \def\dodefineprocessseplist#1#2% separator \docommand % {\def\dodoprocessseplist##1##2#1% % {\ifx\relax##1% % \expandafter\nodoprocessseplist % \else\ifx##1#1% % #2{}% % #2{##2}% % \expandafter\expandafter\expandafter\dodoprocessseplist % \else % #2{##1##2}% % \expandafter\expandafter\expandafter\dodoprocessseplist % \fi\fi}% % \def\doprocessseplist##1\relax % {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} % % a version more robust with regard to {a a} b c d situations \edef\detokenizedrelax{\detokenize{\relax}} \def\dodefineprocessseplist#1#2% separator \docommand {\def\dodoprocessseplist##1##2#1% {\edef\!!stringa{\detokenize{##1}}% \ifx\detokenizedrelax\!!stringa \expandafter\nodoprocessseplist \else\ifx\!!stringa#1% #2{}% #2{##2}% \expandafter\expandafter\expandafter\dodoprocessseplist \else #2{##1##2}% \expandafter\expandafter\expandafter\dodoprocessseplist \fi\fi}% \def\doprocessseplist##1\relax {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} \def\nodoprocessseplist#1\end {} \long\def\processseplist#1#2#3\relax raw version {\dodefineprocessseplist{#1}{#2}% \dodoprocessseplist#3#1\relax#1\relax\relax\end} % \dodefineprocessseplist{,}\test % \dodoprocessseplist{,}a,b,c\relax,\relax\relax\end % \doprocessseplista,b,c\relax % \def\test#1{[#1]} % \startlines % \processseplist{,}\test ,2,,\relax % \processseplist{,}\test ,,,44\relax % \processseplist{,}\test ,,33,44\relax % \processseplist{,}\test 11,,33,44\relax % \processseplist{,}\test 1,2,3,4\relax % \stoplines \newtoks\separatedlistdata \def\appendseparatedlistparameter#1% {\@EAEAEA\appendtoks\csname\??ls\currentseparatedlist#1\endcsname\to\separatedlistdata} \def\appendseparatedlistcontent#1% {\appendtoks#1\to\separatedlistdata} \def\flushseparatedlistdata {\the\separatedlistdata \separatedlistdata\emptytoks} \def\initializeseparatedlistdata {\separatedlistdata{\egroup}} \def\dontcollectseparatedlist {\def\dodoprocessseparatedfileline {\the\separatedlistdata \separatedlistdata\emptytoks \doprocessseparatedfileline}% \def\dodoprocessseparatedline {\the\separatedlistdata \separatedlistdata\emptytoks \doprocessseparatedline}% \let\flushseparatedlistdata\egroup \let\initializeseparatedlistdata\donothing} \chardef\separatedlistmode\zerocount \def\setcurrentlistseparator {\edef\currentlistseparator {\executeifdefined {\??ls::\csname\??ls\currentseparatedlist\c!separator\endcsname}% {\csname\??ls\currentseparatedlist\c!separator\endcsname}}% \doifvalue{\??ls\currentseparatedlist\c!separator}{tab} {\catcode`\^^I=12\relax}% \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi} \bgroup \catcode`\^^I=12 \setgvalue{\??ls::tab}{ } \setgvalue{\??ls::space}{ } \setgvalue{\??ls::comma}{,} \egroup \def\doprocessseparatedfileline {\ifeof\scratchread \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi \immediate\closein\scratchread \expandafter\flushseparatedlistdata \else\ifx\line\empty % skip, can be comment \read\scratchread to\line \@EA\dodoprocessseparatedfileline \else \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% \ifx\currentlistquotechar\empty% \expandafter\doprocessseplist\line\relax \else \expanded{\processquotedlist{}{\noexpand\end}% {\currentlistseparator}{\currentlistquotechar}% \noexpand\doprocessseparatedquoteditem \line\currentlistseparator\noexpand\end}% \fi \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi \read\scratchread to\line \@EAEAEA\dodoprocessseparatedfileline \fi\fi} \def\dodoprocessseparatedfileline {\doprocessseparatedfileline} \def\doprocessseparatedfile[#1][#2]% {\bgroup \edef\currentseparatedlist{#1}% \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% \setcurrentlistseparator \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem \initializeseparatedlistdata \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi \endlinechar\minusone \ignorelines \catcode`\#\@@comment \immediate\openin\scratchread=#2\relax % todo: \doopenin \read\scratchread to\line \doprocessseparatedfileline} \def\dostartseparatedlist#1[#2]% {\bgroup \edef\currentseparatedlist{#2}% \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% \obeylines \let#1\relax \def\separateslistend{#1}% \setcurrentlistseparator \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% \initializeseparatedlistdata \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi \dodostartseparatedlist} \def\redoprocessseparatedline#1% {\def\!!stringa{#1}% \ifx\!!stringa\separateslistend \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi \expandafter\flushseparatedlistdata \else% \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% \ifx\currentlistquotechar\empty% \doprocessseplist#1\relax \else% \defconvertedargument\csvdata{#1}% \expanded{\processquotedlist{}{\noexpand\end}% {\currentlistseparator}{\currentlistquotechar}% \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% \fi \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi \expandafter\dodoprocessseparatedline \fi} \def\doprocessseparatedline {\doifnextbgroupelse\xdoprocessseparatedline\ydoprocessseparatedline} \def\dodoprocessseparatedline {\doprocessseparatedline} \def\doprocessseparateditem#1% {\ifcase\separatedlistmode \appendseparatedlistparameter\c!left \appendseparatedlistcontent{#1}% \appendseparatedlistparameter\c!right \else \appendseparatedlistcontent{{#1}}% \fi} \bgroup \obeylines \gdef\dodostartseparatedlist#1 {\doprocessseparatedline} \gdef\xdoprocessseparatedline#1#2 {\redoprocessseparatedline{{{#1}}#2}} \gdef\ydoprocessseparatedline#1 {\redoprocessseparatedline{#1}} \egroup \startsetups CSV:unix \catcode`\#=\@@comment \stopsetups \def\defineseparatedlist {\dodoubleempty\dodefineseparatedlist} \def\dodefineseparatedlist[#1][#2]% {\setvalue{\e!start#1}{\expandafter\dostartseparatedlist\csname\e!stop#1\endcsname[#1]}% \getparameters [\??ls#1] [\c!separator=, \c!quotechar=, \c!first=, \c!left=, \c!before=, \c!right=, \c!last=, \c!after=, % \c!command=, #2]} \def\setupseparatedlist {\dodoubleempty\dosetupseparatedlist} \def\dosetupseparatedlist[#1]% [#2] {\getparameter[\??ls#1]} % [#2] \def\startseparatedlist[#1]% {\dostartseparatedlist\stopseparatedlist[#1]} \def\processseparatedfile {\dodoubleargument\doprocessseparatedfile} \protect \doifnotmode{demo}{\endinput} \defineseparatedlist [CSV] [separator={,}, first=\bTR,last=\eTR, left=\bTD,right=\eTD, before=\bTABLE,after=\eTABLE] \startseparatedlist[CSV] a,b,c d,e,f \stopseparatedlist \startCSV a,b,c d,e,f \stopCSV \defineseparatedlist [CSV] [separator={,}, quotechar={"}, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] \startCSV a,b,"c,d" d,"""",f \stopCSV \defineseparatedlist [CSV] [separator={ }, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] \startCSV a b c d e f \stopCSV \defineseparatedlist [CSV] [setups=unix, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] % \startsetups CSV:unix % \catcode`\#=\@@comment % \stopsetups % %1,2,3 % 1,2,3 % # 4,5,6 % 4,5,6 \processseparatedfile[CSV][test.dat] \defineseparatedlist [CSVX] [command=\Whatever, separator={,}, first=\bTR,last=\eTR, left=\bTD,right=\eTD, before=\bTABLE,after=\eTABLE] \def\Whatever#1#2#3{[#1][#2][#3]\endgraf} \startseparatedlist[CSVX] a,b,c d,e,f \stopseparatedlist \stoptext --------------000106020605080809090507 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --------------000106020605080809090507--