<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Don’t forget to check any datasets handed to you that advertise as UTF-16 or UTF-8 because people may have injected mixed codings into the dataset. I’ve encountered that more than once. Really gets you with Norwegian characters æ,ø, and å.</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">Always good to review on this ugly topic</div>
<div class=""><a href="http://www.joelonsoftware.com/articles/Unicode.html" class="">http://www.joelonsoftware.com/articles/Unicode.html</a></div>
<div class=""><a href="http://htmlpurifier.org/docs/enduser-utf8.html" class="">http://htmlpurifier.org/docs/enduser-utf8.html</a></div>
<div class=""></div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 20. jan. 2015, at 21.43, David Gobbi <<a href="mailto:david.gobbi@gmail.com" class="">david.gobbi@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="gmail_extra">
<div class="gmail_quote">On Tue, Jan 20, 2015 at 12:43 PM, Serge Lalonde <span dir="ltr" class="">
<<a href="mailto:serge@infolytica.com" target="_blank" class="">serge@infolytica.com</a>></span> wrote:
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="">Your function ConvertLatin1ToUtf8() works great and now I can at least get the extended ASCII Latin1 encoded characters</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">You must have noticed that I forgot to declare the string variable "s" in my function :)</div>
<div class=""><br class="">
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="">My app is actually using managed C++ to glue together the C# GUI with the C++ VTK. This works surprisingly well.<br class="">
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).</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">Using vtkUnicodeString, the conversion will be a three-step process:</div>
<div class="">1) store the Windows unicode string in an "unsigned short" array</div>
<div class="">2) call from_utf16() to make a vtkUnicodeString</div>
<div class="">3) call utr8_str() to convert it to UTF--8</div>
<div class=""><br class="">
</div>
<div class="">I hope this works. I've never tried it myself.</div>
<div class=""><br class="">
</div>
<div class=""> - David</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class="">
<br class="">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" class="">
http://www.kitware.com/opensource/opensource.html</a><br class="">
<br class="">
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" class="">
http://www.vtk.org/Wiki/VTK_FAQ</a><br class="">
<br class="">
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" class="">
http://markmail.org/search/?q=vtkusers</a><br class="">
<br class="">
Follow this link to subscribe/unsubscribe:<br class="">
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" class="">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</body>
</html>