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

Sean McBride sean at rogue-research.com
Tue Jan 20 11:05:47 EST 2015


On Tue, 20 Jan 2015 10:18:44 -0500, Serge Lalonde said:

>I'm upgrading from VTK 5.10.1 to VTK 6.1. All went smoothly until I ran
>into an error rendering a vtkScalarBarActor whose title was set to "J (A/m2)".
>
>This worked fine in 5.10.1, but in 6.1, the vtkutf8::is_valid() method
>called from vtkUnicodeString::from_utf8() returns false because the
>value of "2" is 0xB2 (in the extended ASCII range) but the vtkutf8 code
>internally stops at 0x80 (sequence_length() in core.h returns 0). That
>in turn causes a debug message "vtkUnicodeString::from_utf8(): not a
>valid UTF-8 string." to appear and then other problems with vtkTextActor
>not being able to calculate its bounds and so on.

I think you are a bit confused about character encodings (it's a confusing thing!).

First, there are no ASCII characters above 127.  ASCII is a 7 bit code.  What you mean to refer to is ISO-8859-1 aka Latin1.  In that encoding, the 'square' character does indeed seem to be 0xB2:

<https://en.wikipedia.org/wiki/ISO/IEC_8859-1>

8859 is not part of Unicode at all and is not the same as UTF-8.

There are many online Unicode tools, ex:
<http://utf8-chartable.de>

Where you can see the Unicode code point for 'superscript two' is U+00B2, which encoded as UTF-8 is 'c2 b2' in hex.

You might want to read this, which is a helpful classic:

<http://www.joelonsoftware.com/articles/Unicode.html>

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtkusers mailing list