<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="" class="">So I program I make in Canada, would work normally in China? However as soon as I use Chinese characters or the user in China uses Russian characters, things will break in Windows?<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;" class=""><span style="" class=""><br style=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">So before I try to read a file, I'll have to guess the code page first?</span></div><div class="" style="color: rgb(0, 0, 0);
 font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I<span style="" class="">n other words, apply WideCharToMultiByte() with different codepages until I can successfully read the file?</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Now I have to figure out how to set a codepage...</div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div
 class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Maarten<br><span style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span style="" class=""><br></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="" class="" dir="ltr"> <font style="" class="" face="Arial" size="2"> On Friday, June 6, 2014 12:30:15 PM, David Gobbi
 <david.gobbi@gmail.com> wrote:<br style="" class=""> </font> </div>  <br style="" class=""><br style="" class=""> <div style="" class="">Well, in China people use the Chinese edition of Windows which defaults<br style="" class="" clear="none">to a Chinese codepage... so everything works fine for them as long as<br style="" class="" clear="none">they stick to Chinese.<br style="" class="" clear="none"><br style="" class="" clear="none">Things only get complicated when you try to mix several languages on the<br style="" class="" clear="none">same computer.  Working with one language in isolation is never a problem.<br style="" class="" clear="none"><br style="" class="" clear="none">OS X was very smart to standardize of utf-8.  Linux has pretty much done<br style="" class="" clear="none">the same.  But Windows still uses a different 8-bit encoding for every<br style="" class="" clear="none">language.<br style="" class=""
 clear="none"><br style="" class="" clear="none">  David<br style="" class="" clear="none"><br style="" class="" clear="none"><div style="" class="" id="yqtfd18790"><br style="" class="" clear="none">On Fri, Jun 6, 2014 at 10:08 AM, Maarten Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br style="" class="" clear="none">> Hi David,<br style="" class="" clear="none">><br style="" class="" clear="none">> You're the only one replying to this thread and as long as you give me new<br style="" class="" clear="none">> suggestions I keep poking ;-)<br style="" class="" clear="none">><br style="" class="" clear="none">> I started using WideCharToMultiByte() directly as well, but this returns a<br style="" class="" clear="none">> '?' on the spot of my Chinese character. VtkImageReader2 (and I think all<br style="" class=""
 clear="none">> other readers as well) cannot find a file with this file name.<br style="" class="" clear="none">><br style="" class="" clear="none">> How do people use VTK in China (or Russia, Greece...)?<br style="" class="" clear="none">><br style="" class="" clear="none">> Maarten<br style="" class="" clear="none">><br style="" class="" clear="none">><br style="" class="" clear="none">> On Friday, June 6, 2014 11:41:22 AM, David Gobbi <<a style="" class="" shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br style="" class="" clear="none">> wrote:<br style="" class="" clear="none">><br style="" class="" clear="none">><br style="" class="" clear="none">> Hi Maarten,<br style="" class="" clear="none">><br style="" class="" clear="none">> I've never used ToNarrow() myself, so I think you're relying a bit too<br style="" class=""
 clear="none">> much on my expertise ;)<br style="" class="" clear="none">><br style="" class="" clear="none">> However, I have used WideCharToMultiByte() directly, and if given<br style="" class="" clear="none">> CP_UTF8 as the first argument, it converts to UTF8.  It simply does<br style="" class="" clear="none">> the conversion according to the codepage passed in the first argument.<br style="" class="" clear="none">><br style="" class="" clear="none">> - David<br style="" class="" clear="none">><br style="" class="" clear="none">> On Fri, Jun 6, 2014 at 9:14 AM, Maarten Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br style="" class="" clear="none">>> Hi David,<br style="" class="" clear="none">>><br style="" class="" clear="none">>> After copying the ushort string into a wchar_t string,
 ::ToNarrow() would<br style="" class="" clear="none">>> return nonsense.<br style="" class="" clear="none">>><br style="" class="" clear="none">>> I gave the variable KWSYS_ENCODING_DEFAULT_CODEPAGE the value CP_UTF8<br style="" class="" clear="none">>> (defaults to CP_ACP in the vtksys CMakeLists.txt if nothing is defined) by<br style="" class="" clear="none">>> using the add entry button in CMake.<br style="" class="" clear="none">>> After rebuilding VTK, this didn't solve the problem.<br style="" class="" clear="none">>><br style="" class="" clear="none">>> Would the codepage setting of the computer have to be set to CP_UTF8 at<br style="" class="" clear="none">>> the<br style="" class="" clear="none">>> moment of file creation for this to work? Although, this wouldn't affect<br style="" class="" clear="none">>> my<br style="" class="" clear="none">>> problem of getting the
 correct char* into the SetFileName() function.<br style="" class="" clear="none">>> Would<br style="" class="" clear="none">>> it?<br style="" class="" clear="none">>><br style="" class="" clear="none">>> Maarten<br style="" class="" clear="none">>><br style="" class="" clear="none">>><br style="" class="" clear="none">>> On Thursday, June 5, 2014 6:45:38 PM, David Gobbi <<a style="" class="" shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br style="" class="" clear="none">>> wrote:<br style="" class="" clear="none">>><br style="" class="" clear="none">>><br style="" class="" clear="none">>> Hi Maarten,<br style="" class="" clear="none">>><br style="" class="" clear="none">>> Yes, vtksys::Encoding::ToNarrow() requires a wchart_t *.  If you like to<br style="" class="" clear="none">>> live<br
 style="" class="" clear="none">>> dangerously, you could just use a reinterpret_cast to convert your ushort<br style="" class="" clear="none">>> *<br style="" class="" clear="none">>> to a wchar_t *, but to be safe you should allocate a wchar_t string of the<br style="" class="" clear="none">>> right size and then copy your ushort string into it.<br style="" class="" clear="none">>><br style="" class="" clear="none">>> VTK doesn't have any cmake options related to unicode.  All file-level<br style="" class="" clear="none">>> stuff<br style="" class="" clear="none">>> in VTK always uses 8-bit strings no matter what build options you choose.<br style="" class="" clear="none">>><br style="" class="" clear="none">>>  David<br style="" class="" clear="none">>><br style="" class="" clear="none">>><br style="" class="" clear="none">>> On Thu, Jun 5, 2014 at 4:20 PM, Maarten
 Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br style="" class="" clear="none">>> wrote:<br style="" class="" clear="none">>>> It's complaining about the ToNarrow() function.<br style="" class="" clear="none">>>> (... symbol "__declspec(dllimport) <bla-bla> __cdecl<br style="" class="" clear="none">>>> vtksys::Encoding::ToNarrow(<bla-bla>) referenced in function <bla-bla> )<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> I got the VS solution from svn before my unicode changes and added the<br style="" class="" clear="none">>>> ToNarrow() function and everything builds fine.<br style="" class="" clear="none">>>> I guess if I build my app with unicode, I should do this with VTK as well<br style="" class="" clear="none">>>> (how?
 don't see such an option in cmake...).<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> However the app crashes in Debug, but not in Release.<br style="" class="" clear="none">>>> In another app, I need to set wchar_t as a build-in type to avoid the<br style="" class="" clear="none">>>> unresolved external symbol error, but then an ushort* (returned by<br style="" class="" clear="none">>>> QString::utf16()) cannot be cast to a wchar_t*... I guess<br style="" class="" clear="none">>>> ::ToNarrow(const<br style="" class="" clear="none">>>> wchar_t*) needs a ::ToNarrow(const ushort*) overload?<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> Maarten<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>><br style="" class=""
 clear="none">>>><br style="" class="" clear="none">>>> On Thursday, June 5, 2014 5:03:56 PM, David Gobbi <<a style="" class="" shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br style="" class="" clear="none">>>> wrote:<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> Hi Maarten,<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> I use the functions in vtksys all the time.  Not specifically the<br style="" class="" clear="none">>>> Encoding functions, but they shouldn't be any different.<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> You said it reported an unresolved symbol error... what symbol<br style="" class="" clear="none">>>> was it complaining
 about?<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>>  David<br style="" class="" clear="none">>>><br style="" class="" clear="none">>>><br style="" class="" clear="none">>>> On Thu, Jun 5, 2014 at 2:56 PM, Maarten Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br style="" class="" clear="none">>>> wrote:<br style="" class="" clear="none">>>>> I am linking my app with vtksys.lib.<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> But your answer also tells me I can use this function in my app.<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> So it must be something else... maybe the fact that my vtk is built with<br style="" class=""
 clear="none">>>>> multibyte and the app with unicode?<br style="" class="" clear="none">>>>> Should find a function in vtksys that is unrelated to this to test.<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> Maarten<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> On Thursday, June 5, 2014 4:31:20 PM, David Gobbi<br style="" class="" clear="none">>>>> <<a style="" class="" shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br style="" class="" clear="none">>>>> wrote:<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> An unresolved symbol just means that you have to link to the
 library,<br style="" class="" clear="none">>>>> e.g. if you have a target_link_libraries() call in your CMakeLists.txt,<br style="" class="" clear="none">>>>> make sure that "vtksys" is listed.<br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>> On Thu, Jun 5, 2014 at 2:20 PM, Maarten Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br style="" class="" clear="none">>>>> wrote:<br style="" class="" clear="none">>>>>> Hi David,<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> Thanks for the quick reply.<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> Sounds complicated, but I'll browse through the windows docs.<br style="" class=""
 clear="none">>>>>><br style="" class="" clear="none">>>>>> In my search for a solution I also bumped into<br style="" class="" clear="none">>>>>> vtksys::Encoding::ToNarrow(),<br style="" class="" clear="none">>>>>> however this gives me an 'unresolved external symbol' link error. I<br style="" class="" clear="none">>>>>> have<br style="" class="" clear="none">>>>>> never used stuff in vtksys (and similar libs like vtkpng, vtktiff)<br style="" class="" clear="none">>>>>> before,<br style="" class="" clear="none">>>>>> so I am not really sure I am supposed to, i.e., these are just<br style="" class="" clear="none">>>>>> functions<br style="" class="" clear="none">>>>>> used by cmake and/or in just the vtk build.<br style="" class="" clear="none">>>>>><br style="" class=""
 clear="none">>>>>> Maarten<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> On Thursday, June 5, 2014 3:44:46 PM, David Gobbi<br style="" class="" clear="none">>>>>> <<a style="" class="" shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br style="" class="" clear="none">>>>>> wrote:<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> Hi Maarten,<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> VTK just uses C++ streams in most of its readers/writers.  On OS X,<br style="" class="" clear="none">>>>>> you'll find that you can use utf-8
 filenames just fine.  Same for<br style="" class="" clear="none">>>>>> linux,<br style="" class="" clear="none">>>>>> for the most part at least.<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> For Windows, you'd have to set the codepage to 65001 (utf-8).  I've<br style="" class="" clear="none">>>>>> done this successfully for console I/O (via SetConsoleOutputCP()),<br style="" class="" clear="none">>>>>> but you'll have to look through the Windows docs to see what function<br style="" class="" clear="none">>>>>> is needed to change the codepage used by CreateFileA.<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>> - David<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>><br style=""
 class="" clear="none">>>>>> On Thu, Jun 5, 2014 at 1:17 PM, Maarten Beek <<a style="" class="" shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br style="" class="" clear="none">>>>>> wrote:<br style="" class="" clear="none">>>>>>> Hi all,<br style="" class="" clear="none">>>>>>><br style="" class="" clear="none">>>>>>> I was wondering if there is a multi-platform way of loading a file<br style="" class="" clear="none">>>>>>> (e.g.<br style="" class="" clear="none">>>>>>> tif, stl) with chinese, russian characters in the file path in VTK.<br style="" class="" clear="none">>>>>>> How would I build VTK with Unicode characters?<br style="" class="" clear="none">>>>>>> Can I use a non-unicode VTK in a unicode app?<br style=""
 class="" clear="none">>>>>>><br style="" class="" clear="none">>>>>>> Thanks - Maarten<br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>>><br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>>><br style="" class="" clear="none">>>><br style="" class="" clear="none">>>><br style="" class="" clear="none">>><br style="" class="" clear="none">>><br style="" class="" clear="none">><br style="" class="" clear="none">><br style="" class="" clear="none"></div><br style="" class=""><br style="" class=""></div>  </div> </div>  </div> </div></body></html>