# [NTG-context] Problem with encoding, XML and writetolist...

Vit Zyka vit.zyka at seznam.cz
Wed Apr 5 11:54:18 CEST 2006

Martin Kolařík wrote:
> Hi Hans,
>
> I've analyzed the situation using different combinations of regimes and encodings, including switching off handling (\donothandleactivecharacter) and it seems to me, that every text with chars > 127, which is fully expanded (as in 8bit.tex), must cause difficulties, because TOC entry read back from TUO is scanned independently and thus spaces are gobbled.

Hi Martin,

we have discussed this problem a year ago. In that time I solve it just
writing '{}' in each title where was needed, like

\chapter{Dobré{} ráno}

Now I have cooked an automatic solution. It is not optimal (effective)
but working. The only needs is to redefine

\def\numcharacter#1{\char#1{}}
\let\dochar\numcharacter

and to load appropriate encoding file once more. Since it is banned a
new macro \reuseencoding was introduce:

For Hans:
It would be nice if this feature was enabled in a standard distro.
Perhaps you will find some more optimal solution...

-------------------------------------------------------
\unprotected
\def\doreuseencoding#1%
{\letvalue{\c!file\f!encodingprefix#1}\empty
\makeshortfilename[\f!encodingprefix#1]%
\startreadingfile
\readsysfile\shortfilename
{\showmessage\m!encodings2{#1}}
{\showmessage\m!encodings3{#1}}%
\stopreadingfile}
\def\reuseencoding[#1]%
{\processcommalist[#1]\doreuseencoding}

\def\numcharacter#1{\char#1{}}
\let\dochar\numcharacter

\reuseencoding[ec]

\enableregime[latin2]

\starttext
\writetolist[chapter]{1}{Dobré ráno}
\expanded{\writetolist[chapter]{2}{Dobré odpoledne}}

\placecontent
\stoptext
-------------------------------------------------------

>
> Now I have solved it using not-stable solution -- I am using triple sequence of \expandafter to expand \XMLflush after \chapter instead \expanded. The solution is not stable as it is ConTeXt implementation dependent.
>
> On the other side, now I do not know, how to partially expand code \chaper{\XMLflush{XMLTag}} to obtain sequence of simple unexpanded chars. Simple \expandafter is not sufficient, more \expandafters is dirty trick and full expansion (\expanded) leads to TOC entry problem. In TeX source this cannot occur (or can occur in strange situations :-), in XML source this is almost rule.
>
> Maybe it would be useful to have in XML engine macro, which expands XMLdata exactly to get read (original) content (like mine triple \expandafter). Maybe such macro already exists and I am a real fool :-)
>
> Thank you for help, have a nice day,
>
> Martin
>
>
>>-----Original Message-----
>>From: ntg-context-bounces at ntg.nl [mailto:ntg-context-bounces at ntg.nl]On
>>Behalf Of Hans Hagen
>>Sent: Monday, April 03, 2006 11:57 AM
>>To: martin.kolarik at email.cz; mailing list for ConTeXt users
>>Subject: Re: [NTG-context] Problem with encoding, XML and writetolist...
>>
>>
>>Martin Kolařík wrote:
>>
>>>Aha, here maybe will be the solution :-)
>>>
>>>I'am using standalone Win32 distribution from Pragma and I'm
>>
>>running texexec with --translate=cp1252cs. Typescripts use il2,
>>which corresponds to fonts, of course. If I run the code without
>>XML (if I transcribe XML to \chapter etc.) I get toc entry correctly too.
>>
>>>Where should I look for more? What is natural.ctx?
>>>
>>
>>this is a one-to-one translation vector, and the one standard
>>used by context; forget about all those other mappings, they can
>>be done using regimes; you can use an il2 input regime, and any
>>(resonable) font encoding,
>>
>>Hans
>>
>>-----------------------------------------------------------------
>>                                          Hans Hagen | PRAGMA ADE
>>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>>                                             | www.pragma-pod.nl
>>-----------------------------------------------------------------
>>
>>_______________________________________________
>>ntg-context mailing list
>>ntg-context at ntg.nl
>>http://www.ntg.nl/mailman/listinfo/ntg-context
>>
>
>
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

--
=======================================================
Ing. Vít Zýka, Ph.D.                         TYPOkvítek

database publishing              databazove publikovani
data maintaining and typesetting in typographic quality
priprava dat a jejich sazba v typograficke kvalite

tel.: (+420) 777 198 189     www: http://typokvitek.com
=======================================================



More information about the ntg-context mailing list