<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div><span>Hi David,</span></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;"><br><span></span></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;"><span>After copying the ushort string into a wchar_t string, ::ToNarrow() would return nonsense.</span></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;"><br><span></span></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;"><span>I gave the variable KWSYS_ENCODING_DEFAULT_CODEPAGE the value CP_UTF8 (defaults to CP_ACP in the vtksys CMakeLists.txt if nothing is defined) by using the add entry button in CMake.</span></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;"><span>After rebuilding VTK, this didn't solve the problem.</span></div><br>Would the codepage setting of the computer have to be set to CP_UTF8 at the moment of file creation for this to work? Although, this wouldn't affect my problem of getting the correct char* into the SetFileName() function. Would it?<br><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;"><br><span></span></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;"><span>Maarten</span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Thursday, June 5, 2014 6:45:38 PM, David Gobbi <david.gobbi@gmail.com> wrote:<br> </font> </div>  <br><br> <div class="y_msg_container">Hi Maarten,<br clear="none"><br clear="none">Yes, vtksys::Encoding::ToNarrow() requires a wchart_t *.  If you like to live<br clear="none">dangerously,
 you could just use a reinterpret_cast to convert your ushort *<br clear="none">to a wchar_t *, but to be safe you should allocate a wchar_t string of the<br clear="none">right size and then copy your ushort string into it.<br clear="none"><br clear="none">VTK doesn't have any cmake options related to unicode.  All file-level stuff<br clear="none">in VTK always uses 8-bit strings no matter what build options you choose.<br clear="none"><br clear="none">  David<br clear="none"><br clear="none"><div class="yqt1155968459" id="yqtfd80703"><br clear="none">On Thu, Jun 5, 2014 at 4:20 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br clear="none">> It's complaining about the ToNarrow() function.<br clear="none">> (... symbol "__declspec(dllimport) <bla-bla> __cdecl<br clear="none">> vtksys::Encoding::ToNarrow(<bla-bla>)
 referenced in function <bla-bla> )<br clear="none">><br clear="none">> I got the VS solution from svn before my unicode changes and added the<br clear="none">> ToNarrow() function and everything builds fine.<br clear="none">> I guess if I build my app with unicode, I should do this with VTK as well<br clear="none">> (how? don't see such an option in cmake...).<br clear="none">><br clear="none">><br clear="none">> However the app crashes in Debug, but not in Release.<br clear="none">> In another app, I need to set wchar_t as a build-in type to avoid the<br clear="none">> unresolved external symbol error, but then an ushort* (returned by<br clear="none">> QString::utf16()) cannot be cast to a wchar_t*... I guess ::ToNarrow(const<br clear="none">> wchar_t*) needs a ::ToNarrow(const ushort*) overload?<br clear="none">><br clear="none">> Maarten<br clear="none">><br clear="none">><br clear="none">><br
 clear="none">> On Thursday, June 5, 2014 5:03:56 PM, David Gobbi <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br clear="none">> wrote:<br clear="none">><br clear="none">><br clear="none">> Hi Maarten,<br clear="none">><br clear="none">> I use the functions in vtksys all the time.  Not specifically the<br clear="none">> Encoding functions, but they shouldn't be any different.<br clear="none">><br clear="none">> You said it reported an unresolved symbol error... what symbol<br clear="none">> was it complaining about?<br clear="none">><br clear="none">>   David<br clear="none">><br clear="none">><br clear="none">> On Thu, Jun 5, 2014 at 2:56 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br clear="none">>> I am
 linking my app with vtksys.lib.<br clear="none">>><br clear="none">>> But your answer also tells me I can use this function in my app.<br clear="none">>><br clear="none">>> So it must be something else... maybe the fact that my vtk is built with<br clear="none">>> multibyte and the app with unicode?<br clear="none">>> Should find a function in vtksys that is unrelated to this to test.<br clear="none">>><br clear="none">>> Maarten<br clear="none">>><br clear="none">>><br clear="none">>> On Thursday, June 5, 2014 4:31:20 PM, David Gobbi <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br clear="none">>> wrote:<br clear="none">>><br clear="none">>><br clear="none">>> An unresolved symbol just means that you have to link to the library,<br clear="none">>> e.g. if you have a
 target_link_libraries() call in your CMakeLists.txt,<br clear="none">>> make sure that "vtksys" is listed.<br clear="none">>><br clear="none">>> On Thu, Jun 5, 2014 at 2:20 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">>> wrote:<br clear="none">>>> Hi David,<br clear="none">>>><br clear="none">>>> Thanks for the quick reply.<br clear="none">>>><br clear="none">>>> Sounds complicated, but I'll browse through the windows docs.<br clear="none">>>><br clear="none">>>> In my search for a solution I also bumped into<br clear="none">>>> vtksys::Encoding::ToNarrow(),<br clear="none">>>> however this gives me an 'unresolved external symbol' link error. I have<br clear="none">>>> never used stuff in vtksys (and similar libs like vtkpng,
 vtktiff)<br clear="none">>>> before,<br clear="none">>>> so I am not really sure I am supposed to, i.e., these are just functions<br clear="none">>>> used by cmake and/or in just the vtk build.<br clear="none">>>><br clear="none">>>> Maarten<br clear="none">>>><br clear="none">>>><br clear="none">>>> On Thursday, June 5, 2014 3:44:46 PM, David Gobbi <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br clear="none">>>> wrote:<br clear="none">>>><br clear="none">>>><br clear="none">>>> Hi Maarten,<br clear="none">>>><br clear="none">>>> VTK just uses C++ streams in most of its readers/writers.  On OS X,<br clear="none">>>> you'll find that you can use utf-8 filenames just fine.  Same for linux,<br clear="none">>>> for the most
 part at least.<br clear="none">>>><br clear="none">>>> For Windows, you'd have to set the codepage to 65001 (utf-8).  I've<br clear="none">>>> done this successfully for console I/O (via SetConsoleOutputCP()),<br clear="none">>>> but you'll have to look through the Windows docs to see what function<br clear="none">>>> is needed to change the codepage used by CreateFileA.<br clear="none">>>><br clear="none">>>> - David<br clear="none">>>><br clear="none">>>><br clear="none">>>> On Thu, Jun 5, 2014 at 1:17 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">>>> wrote:<br clear="none">>>>> Hi all,<br clear="none">>>>><br clear="none">>>>> I was wondering if there is a multi-platform way of loading a file (e.g.<br
 clear="none">>>>> tif, stl) with chinese, russian characters in the file path in VTK.<br clear="none">>>>> How would I build VTK with Unicode characters?<br clear="none">>>>> Can I use a non-unicode VTK in a unicode app?<br clear="none">>>>><br clear="none">>>>> Thanks - Maarten<br clear="none">>>><br clear="none">>>><br clear="none">>><br clear="none">>><br clear="none">><br clear="none">><br clear="none"></div><br><br></div>  </div> </div>  </div> </div></body></html>