[mercury-users] Problem with non-ASCII characters in term_io__read_term
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu May 30 13:31:08 AEST 2002
On 29-May-2002, Ondrej Bojar <oboj7042 at ss1000.ms.mff.cuni.cz> wrote:
> I use term_io__read_term and io__write to read and write configuration
> files. My terms contain non-ASCII characters (ISO-8859-2 encoded letters
> with Czech accents).
>
> When I read the terms for the first time, Mercury gets correct characters
> and is able to print them back, so they appear on my terminal correctly.
> When I "compile" the configuration file to other set of terms with exactly
> the same string constants in it, the compiled file contains all accented
> characters escaped with \ and an octal code. So far so good.
Actually this is the point at which things have already gone wrong.
The correct output is a backslash, the octal code, and then a terminating
backslash. This is the ISO-Prolog (and Mercury) syntax for octal escapes.
The reason we don't output the terminating backslash was to ensure that
the output is readable with non-ISO-conforming Prolog implementations
such as NU-Prolog and (old versions of?) SICStus Prolog. However, now
that we have long since abandoned the use of Prolog for bootstrapping,
this is no longer needed. And as you have noticed, it causes incorrect
behaviour when there are two or more special characters in a row and
you try to read the output back in again.
I am currently testing out a patch to fix this.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list