Fixed #10702 (encoding not used in HTML handler)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,7 +77,30 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
|
|||||||
|
|
||||||
buffer->Defragment();
|
buffer->Defragment();
|
||||||
|
|
||||||
wxTextOutputStream str(stream);
|
#if wxUSE_UNICODE
|
||||||
|
wxCSConv* customEncoding = NULL;
|
||||||
|
wxMBConv* conv = NULL;
|
||||||
|
if (!GetEncoding().IsEmpty())
|
||||||
|
{
|
||||||
|
customEncoding = new wxCSConv(GetEncoding());
|
||||||
|
if (!customEncoding->IsOk())
|
||||||
|
{
|
||||||
|
delete customEncoding;
|
||||||
|
customEncoding = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (customEncoding)
|
||||||
|
conv = customEncoding;
|
||||||
|
else
|
||||||
|
conv = & wxConvUTF8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
wxTextOutputStream str(stream, wxEOL_NATIVE, *conv);
|
||||||
|
#else
|
||||||
|
wxTextOutputStream str(stream, wxEOL_NATIVE);
|
||||||
|
#endif
|
||||||
|
|
||||||
wxTextAttr currentParaStyle = buffer->GetAttributes();
|
wxTextAttr currentParaStyle = buffer->GetAttributes();
|
||||||
wxTextAttr currentCharStyle = buffer->GetAttributes();
|
wxTextAttr currentCharStyle = buffer->GetAttributes();
|
||||||
@@ -150,6 +173,12 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
|
|||||||
str << wxT("</body></html>");
|
str << wxT("</body></html>");
|
||||||
|
|
||||||
str << wxT("\n");
|
str << wxT("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
if (customEncoding)
|
||||||
|
delete customEncoding;
|
||||||
|
#endif
|
||||||
|
|
||||||
m_buffer = NULL;
|
m_buffer = NULL;
|
||||||
|
|
||||||
@@ -256,7 +285,7 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttr& WXUNUSED(
|
|||||||
str << wxString::Format(wxT("<p align=\"%s\""), align.c_str());
|
str << wxString::Format(wxT("<p align=\"%s\""), align.c_str());
|
||||||
|
|
||||||
if (thisStyle.HasParagraphSpacingAfter() && thisStyle.GetParagraphSpacingAfter() == 0)
|
if (thisStyle.HasParagraphSpacingAfter() && thisStyle.GetParagraphSpacingAfter() == 0)
|
||||||
str << wxT(" style=\"line-height: 0px\"");
|
str << wxT(" style=\"margin: 0px;\"");
|
||||||
|
|
||||||
str << wxT(">");
|
str << wxT(">");
|
||||||
|
|
||||||
@@ -284,7 +313,7 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttr& WXUNUSED(
|
|||||||
str << wxString::Format(wxT("<p align=\"%s\""), align.c_str());
|
str << wxString::Format(wxT("<p align=\"%s\""), align.c_str());
|
||||||
|
|
||||||
if (thisStyle.HasParagraphSpacingAfter() && thisStyle.GetParagraphSpacingAfter() == 0)
|
if (thisStyle.HasParagraphSpacingAfter() && thisStyle.GetParagraphSpacingAfter() == 0)
|
||||||
str << wxT(" style=\"line-height: 0px\"");
|
str << wxT(" style=\"margin: 0px;\"");
|
||||||
|
|
||||||
str << wxT(">");
|
str << wxT(">");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user