From: Rainer Deyke (rainerd_at_[hidden])
Date: 2004-08-22 22:27:51
Stefan Seefeld wrote:
> Isn't it abusive to force utf-8 into a std::string ? While it is
> technically possible the semantics isn't quite the same. operator
>  (size_t i) wouldn't return the i'th character any more, at
> least not for characters outside the ascii range.
I don't think so. In C and C++, the type 'char' represents not only a text
character, but also a byte of binary data. For example, when using the
iostream library to read binary files, the data will be read as a sequence
of 'char's. 'std::string' is the most useful container for blocks of binary
data, largely because of the stringstream classes.
Utf-8 is just a special case of binary data.
-- Rainer Deyke - rainerd_at_[hidden] - http://eldwood.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk