Lars Gullik Bjønnes wrote:

> Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> | Jean-Marc Lasgouttes wrote:
> | > Angus> In Python, you can write: unicode(string,'latex+latin1')
> | > Angus> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252124
> | 
> | > Angus> so I guess that we could define a similar converter and pop up
> | > Angus> an error box if a character cannot be converted.
> | 
> | > Yes, if the number of characters we want to translated is small
> | > enough.
> | 
> | I'd hope that we could either cut and paste a character array or,
> | better, use libiconv to do the work for us.
> | 
> |        #include <iconv.h>
> | 
> |        iconv_t iconv_open(const char *tocode, const char *fromcode);
> | 
> |        size_t iconv(iconv_t cd,
> |                      char **inbuf, size_t *inbytesleft,
> |                      char **outbuf, size_t *outbytesleft);
> | 
> |        int iconv_close(iconv_t cd);
> | 
> | In other words, use ICU to create a UTF-8 version of the latex file and
> | then pass this through iconv to generate a latin-1 encoding.
> 
> That will work "just like that" in a lot of cases, but remmeber that
> our .lyx file does not really have a defined norm.

Surely, it will always work with all "new" LyX files created with the
unicoded LyX 1.5? .lyx files saved by LyX 1.5 will be UTF-8 encoded,
right?

Assuming that this is the case, the problem will be one of converting
pre-LyX 1.5 files to LyX 1.5 format. Ie, a lyx2lyx problem. I'd anticipate
that lyx2lyx would assume that the .lyx file it receives as input was
encoded in the system locale unless told otherwise. It should probably
emit a warning about this and abort if it comes across illegal characters.
Similarly, it should be possible to specify the encoding of the input file
implicitly.

Just thinking out loud...

-- 
Angus

Reply via email to