Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Custom encoding command for .msg files.

Closed / Rejected744156ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-05-27 09:50:05
Writing or reading .msg files with a lot of backslashed unicode 
sequences to represent accentuated characters is not easy. 
But if we want to use a custom encoding, msgcat have to be 
inform that this particular msg file doesn't use default UTF-8 
encoding. So, we might add the following command in the msg 
file:

::msgcat::msgEncoding iso8859-15

Then, 
msgcat would uses iso8858-15 encoding instead of UTF-8 for 
the next [mcset] commands, until another [msgEncoding] 
command was find or EOF was reached.

In order to 
preserve backward compatibility, msg files without 
[msgEncoding] command would be considered using UTF-8 
encoding.

This command should only be used in msg 
files too, to preserve default UTF-8 compatibility.
dgpplain2003-06-02 23:19:25
Logged In: YES 
user_id=80530


As specified, this request does not really
make sense.  The msgcat package uses
the utf-8 encoding when reading *.msg files.

The utf-8 encoding is in effect for the entire
file reading operation, as usual for managing
encoding of channels.  There is no encoding
control of individual commands one by one,
nor do I think there should be.

The *.msg files are expected to be in the
utf-8 encoding precisely so you do not
have to use \uHHHH escapes to represent
non-7-bit-ASCII characters.  Just use an
editor that can save your *.msg file in the
utf-8 encoding instead of your system encoding.
The utf-8 encoding can represent all Unicode
characters that Tcl recognizes, so there's no
need to have any \uHHHH escapes at all in
a *.msg file.

If you do not have an editor that can save
in UTF-8, it should be a simple post-process
to [fcopy] the file produced by your editor to
a new file in utf-8 by [open]-ing both files
and using [fconfigure] to set input encoding
to the encoding produced by your editor,
and output encoding to utf-8.

Setting this report to Pending.  It will close
itself unless someone follows up with a
better explanation for why utf-8 encoded
*.msg files are not adequate.
Log in (anonymous is fine) to add a comment.