special characters like ñ to set the file name in itk, visual studio (windows)

Hi everybody,

I wonder how to deal with filenames with special characters like ñ in SetInputDirectory(std::string const &name) as when we open directories with ñ, it says that it does not exist because of these characters.

Thanks

Unicode support should be improved since this commit, which made it into ITK 5.0. Independent of that, if you set your operating system’s code page to the one which includes ñ, it should work with both ITK 4 and 5.

There is an important (relatively new) option, which makes it much easier to make Windows applications switch to UTF-8: since Windows10 May 2019 Update, the process code page can be set to UTF-8.

This allows us to use plain fopen API with UTF-8 file names on Windows the same way as on Mac and Linux. There is no need to convert filenames to UTF-16 ( WCHAR ) and use _wfopen anymore or use itksys::SystemTools::Fopen. This is convenient because we don’t need to make hundreds of changes in ITK and invasive patches in third-party libraries.

I’ve tested it and works well. I only had to add the manifest file to the list of source files in CMake add_executable (in CTK, I’ve added add_executable_utf8 macro for this).

I think this is a very cost-efficient way of achieving “UTF-8 everywhere”. It could be useful to coordinate between VTK, ITK, CMake, and application developers, to make it easy to leverage this opportunity.

2 Likes