[vtkusers] VTK 6.1 no longer supports ASCII characters > 128? (5.10.1 was ok)

David Gobbi david.gobbi at gmail.com
Tue Jan 20 15:43:44 EST 2015


On Tue, Jan 20, 2015 at 12:43 PM, Serge Lalonde <serge at infolytica.com>
wrote:
>
> Your function ConvertLatin1ToUtf8() works great and now I can at least get
> the extended ASCII Latin1 encoded characters
>

You must have noticed that I forgot to declare the string variable "s" in
my function :)

My app is actually using managed C++ to glue together the C# GUI with the
> C++ VTK. This works surprisingly well.
> The "problem" (if you can call it that) is that C# strings are stored
> internally in Unicode. Some of the text we'd like to display is not
> available in the Latin1 encoding (ex: special unit symbols).
>

If I recall correctly, Windows uses UTF-16 as its native "unicode" encoding
(always stored as wchar_t).  So you need something to convert UTF-16 to
UTF-8.

Using vtkUnicodeString, the conversion will be a three-step process:
1) store the Windows unicode string in an "unsigned short" array
2) call from_utf16() to make a vtkUnicodeString
3) call utr8_str() to convert it to UTF--8

I hope this works.  I've never tried it myself.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150120/c199875a/attachment.html>


More information about the vtkusers mailing list