git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@637
a5681a0c-68f1-0310-ab6d-
d61299d08faa
cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */
string->count=mbstowcs(cstr,text,clen);
if ( string->count == -1){
- string->count=mbstowcs(cstr,"Enc-Err",6);
+ /* conversion did not work, so lets fall back to just use what we got */
+ string->count=clen-1;
+ for(n=0;text[n] != '\0';n++){
+ cstr[n]=text[n];
+ }
}
#else
char *cstr = strdup(text);