[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DotGNU]patches for encoding code
From: |
Paolo Molaro |
Subject: |
[DotGNU]patches for encoding code |
Date: |
Tue, 19 Nov 2002 13:22:10 +0100 |
User-agent: |
Mutt/1.4i |
These are the patches we applied today to our System.Text/ encoding
types (the code was donated by Rhys to mono some time ago, we're giving
back our patches to the code).
The issue is: when an encoding (utf8, Unicode) has a preamble, the
previous code accounted for it every time GetBytes() and GetByteCount()
is called on a string. The preamble is only needed at the start of a
stream, though, and the output didn't match the output from the MS
runtime. We moved the preamble output to the StreamWriter class and
changed the encoding classes to not take into account the preambles for
each string output. For code like:
sw.Write ("hello, ");
sw.Write ("world!");
the output was:
<preamble>hello, <preamble>world!
instead of:
<preamble>hello, world!
I attached two simple tests I used. Note: I couldn't compare the output
from ilrun for utf8-enc.cs since it gives a verification exception, even
when compiled with cscc. Note also that uenc.cs produces a UTF-16
preamble, but utf8 bytes when run on the pnet runtime.
The patch may or may not be directly useful, since we did some
formatting changes to our sources, but using the -l option to patch may
help there.
lupus
--
-----------------------------------------------------------------
address@hidden debian/rules
address@hidden Monkeys do it better
e.diff
Description: Text document
uenc.cs
Description: Text document
utf8-enc.cs
Description: Text document
- [DotGNU]patches for encoding code,
Paolo Molaro <=