Fix bad lengths for utf-8 strings in text_file_writer.cpp
Originally committed to SVN as r4647.
This commit is contained in:
parent
ce4babb192
commit
8bd5b16699
1 changed files with 5 additions and 1 deletions
|
@ -91,7 +91,11 @@ void TextFileWriter::WriteLineToFile(wxString line, bool addLineBreak) {
|
|||
|
||||
// On non-windows this cast does nothing
|
||||
const char *data = reinterpret_cast<const char *>(line.wx_str());
|
||||
size_t len = line.size() * sizeof(wxStringCharType);
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
size_t len = line.utf8_length();
|
||||
#else
|
||||
size_t len = line.length() * sizeof(wxStringCharType);
|
||||
#endif
|
||||
|
||||
if (conv.get()) {
|
||||
std::string buf = conv->Convert(std::string(data, len));
|
||||
|
|
Loading…
Reference in a new issue