[gdal-dev] Motion: To adopt RFC 23: Unicode Support in OGR
warmerdam at pobox.com
Fri Apr 25 08:59:16 EDT 2008
Andrey Kiselev wrote:
> But this way of modifying CPLString is also bad and adds unnecessary
> complication. What I finally suggesting is to assume that the internal
> encoding either UTF-8 when you are constructing string specifying
> encoding or unknown (as it is now) and then you are keeping encoding of
> the string somwhere else.
I'm -1 on suddenly having CPLString do automatic recoding from the
current locale to UTF-8, or from UTF-8 back to the current locale
on removal. This adds a hard to predict amount of extra work and
it is likely to break lots of pieces of existing code that use CPLString
on text that is not necessarily in the current locale.
I deliberately avoiding making the RFC 5 assumption that CPLString
is UTF-8 internally at all times to avoid what could be a lot of
risky and expensive transformations.
I also think it might be hard to get all CPLString methods to honour
the same rules that you imply for the constructors. For instance,
you do not address the assignment operator but it would be perverse
(to me) if CPLString X("abc") gave me a different string than assigning
"abc" to an existing CPLString.
I do understand that my proposed changes to CPLString leave the onus on
higher level code to keep track of the encoding that applies to different
strings. But - really - they still need to be quite aware of this for
values being assigned to CPLString.
I wouldn't be adverse to adding a CPLUTF8String class derived from
CPLString at some point that offered carefully thought out semantics
somewhat similar to what you want. But I (after some initial consideration)
decided not to pursue this idea for now since I don't have the time and
expertise to do it justice, and it really does not seem important to
what I want to do.
Does my rationale make sense? I'm particularly wanting to avoid any
changes in the behavior of existing CPLString use without careful
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the gdal-dev