[vtk-developers] Re: vtkVectorText beyond ASCII - solution
Sean McBride
sean at rogue-research.com
Thu Jan 10 13:51:16 EST 2008
On 1/9/08 7:56 AM, Will Schroeder said:
>I have been following your work with interest. Many of us are not happy with
>the text support in VTK. It has been evolving without real vision for
>several years now, and there are backward compatibility issues. I think with
>all that's going on our priorities have not been in this direction.
>
>Having said that, I know I would personally welcome a vision. Since I am
>traveling now, I can't put much time into thinking about this, but I will
>make a point of talking to some of the developers here at Kitware to see
>what their take is on this. Maybe we can come up with some reasonable ideas
>together and put together a roadmap for future improvement.
Hi Will,
Is the VTK Wiki a good place for discussing this new vision, or is this
list better?
I have a few random thoughts:
1) most VTK strings are currently old-school C strings, created using
malloc/new[] and manipulated with strcpy(), strlen(), etc. This is no
good because:
a) many of these APIs, like strcpy(), are dangerous, as they can lead
to buffer overflows. See:
<http://developer.apple.com/documentation/Security/Conceptual/
SecureCodingGuide/Articles/BufferOverflows.html#//apple_ref/doc/uid/
TP40002577-SW10>
b) these API don't support Unicode
2) wchar_t is no good either because:
a) It is 16 bit on some platform (Windows) and 32 on others (Unix).
Unicode has more than 2^16 code points so wchar_t is too small on Windows.
b) the wchar_t APIs don't support Unicode either.
3) std::string is no good either because:
a) the std::string APIs don't support Unicode either! See:
<http://blogs.msdn.com/ryanmy/archive/2004/10/20/245417.aspx>
String handling is a rather complex subject that many people do not
understand the details of (myself included). I really can't recommend
this article enough:
<http://www.joelonsoftware.com/articles/Unicode.html>
So one thing VTK needs is a cross-platform, open source, Unicode-aware
string class. There are no doubt several. Although I do not have much
personal experience dealing with Unicode strings, I have followed many
discussions on the topic and think ICU is probably one of the better choices:
<http://www.icu-project.org/userguide/strings.html#ustrings_cpp>
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 vtk-developers
mailing list