Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-01-18 08:16:31


> From: Alexander Lamaison <awl03_at_[hidden]>
> > On Mon, 17 Jan 2011 23:50:18 -0800 (PST), Artyom wrote:
> >
> > >
> > > We'll have to agree to disagree there. The whole point to these classes
> > > was to provide the compiler -- and the programmer using them -- with
> > > some way for the string to carry around information about its encoding,
> > > and allow for automatic conversions between different encodings.
> >
> > This is totally different problem. If so you need container like this:
> >
> > class specially_encoded_string {
> > [snip]
> > }
> >
> > Creating "ascii_t" container or anything that that that does
> > not carry REAL encoding name with it would lead to bad things.
>
> I thought the point of using different types was instead of tagging a
> string with an encoding name. In other words, a utf8_t would always hold a
> std::string content_ in UTF-8 format.
>

I'm addressing this problem:

> The whole point to these classes was to
> provide the compiler -- and the programmer
> using them with some way for the string to
> carry around information about its encoding

i.e. sometimes string should come with encoding.

The point is that if the encoding you are using is not
the **default** encoding in your program (i.e. UTF-8)
then you may need to add encoding "tag" to the text,
otherwise just use UTF-8 with std::string.

Artyom

      


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk