<div dir="ltr">Hi Lee,<br><br>I think this is error shows up because you are converting the string to local 8 bit when calling the function .toStdString() *<br>The string must be encoded in Utf8 ** to be rendered properly in VTK.<br><br>Try to replace the lines :<div><div><span style="font-size:12.8000001907349px">----------------------------------------------</span><br><span style="font-size:12.8000001907349px">std::string str = temp.toStdString();</span><div><span style="font-size:12.8000001907349px">const char* ch = str.c_str();</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">m_textActor->SetInput(ch);</span><br></div></div></div><div><span style="font-size:12.8000001907349px">----------------------------------------------<br>by<br></span><span style="font-size:12.8000001907349px">----------------------------------------------<br></span><span style="font-size:12.8000001907349px">m_textActor->SetInput( temp.toUtf8().constData() );<br></span><span style="font-size:12.8000001907349px">----------------------------------------------<br>Also make sure you save your source file in Utf8<br><br></span>Good luck<br><br>Simon<br><br><span style="font-size:12.8000001907349px">* <a href="http://doc.qt.io/qt-4.8/qstring.html#toStdString">http://doc.qt.io/qt-4.8/qstring.html#toStdString</a><br></span>** <a href="http://en.wikipedia.org/wiki/UTF-8">http://en.wikipedia.org/wiki/UTF-8</a><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-28 3:54 GMT+02:00 lee <span dir="ltr"><<a href="mailto:lihouxing@yeah.net" target="_blank">lihouxing@yeah.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
Thanks for your method, but it only works for English character, when<br>
the string contains Chinese characters, errors come up as follow:<br>
<br>
*Generic Warning: In ..\..\..\VTK-6.1.0\Common\Core\vtkUnicodeString.cxx,<br>
line 183<br>
vtkUnicodeString::from_utf8(): not a valid UTF-8 string.<br>
<br>
Generic Warning: In ..\..\..\VTK-6.1.0\Common\Core\vtkUnicodeString.cxx,<br>
line 183<br>
vtkUnicodeString::from_utf8(): not a valid UTF-8 string.<br>
<br>
ERROR: In ..\..\..\VTK-6.1.0\Rendering\FreeType\vtkTextActor.cxx, line 803<br>
vtkScaledTextActor (00D01410): Cannot compute bounding box.<br>
*<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Show-Chinese-Character-on-qvtkwidget-tp5731627p5731648.html" target="_blank">http://vtk.1045678.n5.nabble.com/Show-Chinese-Character-on-qvtkwidget-tp5731627p5731648.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>------------------------------------------------------------------<br>Simon Esneault<div>Rennes, France<br>------------------------------------------------------------------</div></div></div></div>
</div></div>