[Insight-developers] GDCM Compiler Warning: character set encoding

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Aug 7 03:43:32 EDT 2007


On 8/6/07, Sean McBride <sean at rogue-research.com> wrote:
> On 8/6/07 2:59 PM, Mathieu Malaterre said:
>
> >  I have been working quite a lot on this issue. Unfortunately I do
> >not understand how this should be handle. As far as I understand this
> >letter 'µ' can be encoded either as one char (value > 127 on ISO-xxx,
> >typically on european keyboard), or on UTF (with two bytes). What does
> >your locale says on your computer ?
> >
> >  If we cannot find a solution, I'll use what most other toolkit are
> >using, replace 'µ' with ASCII only character ('Micro', 'u'...).
>
> Sadly, it is very hard to use non-ASCII characters in source code,
> especially in projects like ITK that need to support many platforms/compilers.

Encoding µ in the source is just the visible part of the iceberg. You
then need to display it correctly.

> C99 supports a notation for "universal characters".  So for the 'micro
> sign' you could write:
>
> const char* myString = "It is 10 \u00B5m long";

const char myString[] = "It is 10 \u00B5m long";

> The \u00B5 gives a "µ" and keeps your source file ASCII.
>

Apparently one would need L"\u03BC" under windows, or even in some case:

wchar_t const units[] = L"\u03BCA" ;

ref:
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/6c7bd460ecc38918

> I'm not sure if C++ also supports this notation...

Apparently this is implementation specific and depends on your locale.
So I decided to take the short path:

$ cvs ci -m"ENH: Trying to use mue is just too difficult. Instead
replace it with a lower case u" dicomV3.dic
/cvsroot/Insight/Insight/Utilities/gdcm/Dicts/dicomV3.dic,v  <--  dicomV3.dic
new revision: 1.8; previous revision: 1.7


-- 
Mathieu


More information about the Insight-developers mailing list