wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
471 stars 98 forks source link

Error in "export to tex" under Windows CJK enviroment #108

Closed andrejv closed 13 years ago

andrejv commented 13 years ago

Converted from SourceForge issue 3016554, submitted by nobody

While export to tex under WinXp with chinese enviroment, some of the chinese characters are destroyed by strings replaced procedure within GroupCell::PrepareForTeX.

This kind of error may occurs in CJK two-bytes encoding enviroments, under which the second byte of a character being replaced by other character inside GroupCell::PrepareForTeX. .

I have fixed this problem in my working copy of wxMaximax, with following patch, hope this bug been fixed in the next version.

------- recommend modification---- wxString GroupCell::PrepareForTeX(wxString str1) { wxString str(str1.wcstr(wxConvLocal), wxConvUTF8); //<--- change to UTF8 before String Replace str.Replace(wxT("\"), wxT("\verb||")); str.Replace(wxT(""), wxT("_")); str.Replace(wxT("%"), wxT("\%")); str.Replace(wxT("{"), wxT("{")); str.Replace(wxT("}"), wxT("}")); str.Replace(wxT("^"), wxT("\verb|^|")); str.Replace(wxT(">"), wxT("\verb|>|")); str.Replace(wxT("<"), wxT("\verb|<|")); wxString str2(str.wc_str(wxConvUTF8),wxConvLocal ); // <----change back to local encoding return str2;

}

andrejv commented 13 years ago

Submitted by andrejv

The proposed patch has been applied in svn rev. 1387.