>From 816175d72c8d87b81b8a191192566ef7b01dde7a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 1 Oct 2015 14:34:07 +0200 Subject: [PATCH] Interpret all input strings as being in UTF-8 in group quotes code This fixes the appearance of the non-ASCII characters such as REGISTERED SIGN (U+00AE) in the output PDF as previously they were output as raw UTF-8 bytes. --- group_quote_pdf_gen_wx.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp index e427c6b..a3219cc 100644 --- a/group_quote_pdf_gen_wx.cpp +++ b/group_quote_pdf_gen_wx.cpp @@ -74,11 +74,13 @@ enum enum_output_mode wxString escape_for_html_elem(std::string const& s) { + wxString const u = wxString::FromUTF8(s.c_str()); + wxString z; - z.reserve(s.length()); - for(std::string::const_iterator i = s.begin(); i != s.end(); ++i) + z.reserve(u.length()); + for(wxString::const_iterator i = u.begin(); i != u.end(); ++i) { - switch(*i) + switch((*i).GetValue()) { case '<': z += "<" ; break; case '>': z += ">" ; break; @@ -755,7 +757,7 @@ void group_quote_pdf_generator_wx::do_generate_pdf(wxPdfDC& pdf_dc) // FIXME Specification change: use product description here, not company_. wxString const image_text - (report_data_.company_ + (wxString::FromUTF8(report_data_.company_.c_str()) + "\nPremium & Benefit Summary" ); -- 2.5.1