[Insight-developers] Image writing with unicode filename impossible with MSVC

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 12 19:56:33 EDT 2009


Hi Tom,

Sean's warning about the inherit Evilness of wchar_t was
quite convincing...

That plus the perspective of adding code that only works
on Windows are not quite motivating...



So,
to be pragmatic, we certainly could add the wchar_t
versions....

but the question is:


                  How is this going to help ?


if what matter is what each on of the particular ImageIO
classes do with the m_Filename string.

To be more precise, most of the ImageIO classes end up
passing the string to a third party library (such as PNG,
TIFF, JPEG, META, Nifti, Nrrd, GDCM...), so, if that library
doesn't support wchar_t,   we are still dead in the water.

Most of these libraries will end up using :

     ifstream.open()
     ofstream.open()
     fopen()


How are we going to pass those wchar_t down these
other libraries and have them to be interpreted as the
proper character set ?


Are we going to add more Windows conditional code
to ALL of these libraries ?
(I hope the answer here is: no)


I'll suggest we start with adding a minimal tests
that just attempts to do simple operations such as
creating new files with filenames that require a particular
encoding, and see how this can be made portable
across platforms.


Would that make sense ?


      Luis


-----------------------------------------------------------------------------------------
On Wed, Sep 30, 2009 at 12:04 PM, Tom Vercauteren
<tom.vercauteren at m4x.org> wrote:
> Hi all,
>
> Benjamin, a colleague of mine, tried to move forward on the topic of
> unicode filenames. There was a thread going on on the mailing list in
> 2007:
> http://www.itk.org/pipermail/insight-users/2007-July/022828.html
>
> However, there seem to be no workable alternative with visual c++.
> Basically, itk relies on char* filenames that are assumed to be encoded in
> * utf-8 on linux and mac
> * some local encoding on windows based on the current codepage
>
> The problem is that a given codepage does not cover all possible
> unicode characters (unlike utf-8). It seems that on windows wchar_t*
> is required.
>
> There is more information and a unit test on the bug tracker:
> http://public.kitware.com/Bug/view.php?id=9623
>
> Are we missing something here?
>
> Best regards,
> Tom
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list