On Mon, 2015-06-22 at 06:47 +0000, Dineshkumar Ramalingam wrote:
> Hi,
>
> We can able to get the Unicode string by using ‘GetStringW()’ method.
> It returns ‘std::wstring’.
>
> But if we try to convert ‘std::wstring’ to PdfString then it gives
> the wrong characters.
>
> We tries below line to convert ‘std::wstring’ to PdfString,
>
> PdfString pdfstring(reinterpret_cast<const pdf_utf8*>(
> std::wstring.c_str()));
Hi,
std::wstring is defined as typedef basic_string<wchar_t> wstring; [1],
thus wstring::c_str() returns wchar_t *, which is UTF-16, not UTF-8.
You should convert UTF-16 into UTF-8, or use a different constructor of
the PdfString (or simply PdfString::setFromWchar_t()).
Bye,
zyx
[1] http://www.cplusplus.com/reference/string/wstring/
--
http://www.litePDF.cz [email protected]
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users