Hi,
Would it make sense to add a method
PdfString::GetCharacterLength()
{
return this->IsUnicode() ? this->GetUnicodeLength() : this->GetLength();
}
?
I think this is what you need to always determine the correct character
length - assuming the PdfString contains no Utf8 encoded text.
Nontheless I do not think this is often needed. Users will have an own, more
powerful string class to do the actual work with and PdfString will only be
used when text is put into the PDF file. Despite this I would strongly vote
for adding the above method if you think it solves the problem.
best regards,
Dom
PS: The valgrind errors in the ConvertUTF*ToUTF* code are strange as the code
is taken almost directly from the unicode.org pages and should be well
tested.
Am Monday 13 August 2007 schrieb Craig Ringer:
> Hi
>
> The PdfString changes look pretty good to me, having played with them
> for a while.
>
> There are a few memory issues lurking in the unicode code. I haven't
> tracked them down yet. They're not currently causing test failures or
> crashes but definitely need to be fixed. I'll keep working on that but
> not now - I've already spent ages tracking down the PdfDoc->Unicode
> issue (below).
>
> I also hit what appears to be a bug in PdfDoc->Unicode conversion due to
> the use of a signed int index into the conversion array causing issues
> for char values > 127. Using `unsigned char' appears to me to be more
> correct, and does fix the problem. I'd like to make sure you're in
> agreement on this change, and I'm not doing something stupid. If I am,
> it'd be great if you could point out what or fix up the test case to be
> correct.
>
> The only thing that bothers me now is that there's no single method to
> determine how many characters there are in the string. One must check
> IsUnicode() and use GetUnicodeLength() instead of GetLength(). It also
> doesn't appear to be safe to assume that:
>
> str.GetLength() == str.ToUnicode().GetUnicodeLength()
>
> (where !str.IsUnicode())
>
> ... at least at a superficial look.
>
> --
> Craig Ringer
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
--
**********************************************************************
Dominik Seichter - [EMAIL PROTECTED]
KRename - http://www.krename.net - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************
pgp8OJsPlg31S.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
