Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-01-18 09:12:22


At Tue, 18 Jan 2011 05:35:17 -0800 (PST),
Artyom wrote:
>
> > From: Alexander Lamaison <awl03_at_[hidden]>
> > > Dave Abrahams wrote:
> > >
> > >> I think the reason to use separate types is to provide a type-safety
> > >> barrier between your functions that operate on utf-8 and system or
> > >> 3rd-party interfaces that don't or may not. In principle, that should
> > >> force you to think about encoding and decoding at all the places where
> > >> it may be needed, and should allow you to code naturally and with
> > >> confidence where everybody is operating in utf8-land.
> > >
> > > Yes, in principle. It isn't terribly necessary if everybody is operating in
>
> > > UTF-8 land though.
> >
> > Which is exactly why it's necessary: everybody _isn't_ operating in UTF-8
> > land.
> >
>
> The problem is that you need to pic some encoding
> and UTF-8 is the most universal and useful.

Why is that a problem?

> Otherwise you should:
>
> 1. Reinvent the string

My idea is that you just wrap it.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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