ast: serialization, get string size after converstion to take care of multibyte chars
[scilab.git] / scilab / modules / ast / includes / ast / serializervisitor.hxx
index 6f55013..956be61 100644 (file)
@@ -176,8 +176,8 @@ private :
 
     void add_wstring(const std::wstring &w)
     {
-        int size = (int)w.size();
         char *c_str = wide_string_to_UTF8(w.c_str());
+        int size = strlen(c_str);
         int final_size = size * sizeof(char);
         add_uint32(final_size);
         need(final_size);