- wxFontEncoding encoding = font.GetEncoding();
- if ( encoding != wxFONTENCODING_SYSTEM )
- {
- str = StreamOut(encoding);
- }
+ encoding = font.GetEncoding();
+ }
+
+ if ( encoding == wxFONTENCODING_SYSTEM )
+ {
+ encoding = wxLocale::GetSystemEncoding();
+ }
+
+ if ( encoding == wxFONTENCODING_SYSTEM )
+ {
+ encoding = wxFONTENCODING_ISO8859_1;
+ }
+
+ str = StreamOut(encoding);
+
+ if ( !str.empty() )
+ {
+ // we have to manually extract the required part, luckily
+ // this is easy in this case as EOL characters in str are
+ // just LFs because we remove CRs in wxRichEditStreamOut
+ str = str.Mid(from, to - from);