[rust-dev] String encode/decode

Fredrik Håård fredrik at haard.se
Thu Apr 11 13:31:50 PDT 2013


2013/4/11 Kang Seonghoon <someone at mearie.org>

> I do. See also the issue #4837 for my initial ad-hoc attempt.
>
> The inevitable problem here is, of course, whether we should reuse the
> existing iconv library or make our own.


iconv is dependent on locales on Unix / mingw on Windows I believe?

This is also deeply connected
> to the assumption that `str` only contains a valid UTF-8 string (which
> some standard modules break, `ReaderUtil::each_line` for instance).
>

That str only contains valid UTF-8 is good assumption (and rule) I believe;
to me it seems Python 3 got that right and Rust could use the same pattern
of str vs [u8].
I'm not sure that I see the problem here.


> Maybe we should start making an wiki page for entire character
> encoding issues?
>

+1


> Note: If you copy Python's design (which is actually quite good
> compared to many others but not without caveats), try not to copy
> `Stream{Reader,Writer}` at least. These are mostly replaced by newer
> `Incremental{Reader,Writer}` which doesn't require streams at all.
>

Right now my goal is just to create a charmap from the specification, and
start with creating a codec that can handle u8<->char. I need to get a much
better feel for Rust/stdlib before I have a solid opinion on high-level
design choices.

/fredrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20130411/626cdd05/attachment.html>


More information about the Rust-dev mailing list