
AMDG On 04/17/2011 12:25 PM, Phil Endecott wrote:
I don't have time to answer in much detail, but I'll just re-emphasise that I would very much like to see a simple and fast character set conversion like this:
string l1_name = charset_conv<utf8,latin1>(utf8_name);
In my own charset conversion code, I generated a large enum of all the character set names and aliases based on the IANA registry (http://www.iana.org/assignments/character-sets). I then have a fallback converter using iconv, and fast specialisations for cases like utf-to/from-iso8859. I would happily contribute those specialisations if you had a way to plug them in. Currently you offer either conversion functions that take character set names as strings, which I dislike because of the overhead of the run-time lookup that is required (especially for short strings), and stream processing, which I dislike because I don't want the overhead (runtime and lines-of-code) of copying to and from stringstreams.
Of course this only works if the character set is known at compile time. Boost.Locale is all about runtime configuration. Thus, specifying the character set as a string rather than a template parameter is perfectly reasonable. In Christ, Steven Watanabe