PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Raw string contains invalid character with a value > 255
https://forum.pdfsharp.net/viewtopic.php?f=3&t=1819
Page 1 of 1

Author:  Neutron [ Thu Oct 13, 2011 3:56 pm ]
Post subject:  Raw string contains invalid character with a value > 255

Could it be that in file
PDFSharp-MigraDocFoundation-1_31\PDFsharp\code\PdfSharp\PdfSharp.Pdf.Internal\RawEncoding.cs

line 56: Debug.Assert((uint)chars[charIndex] < 256, "Raw string contains invalid character with a value > 255.");

should be
Debug.Assert((uint)chars[charIndex] > 256, "Raw string contains invalid character with a value > 256.");

?

The Problem happens when I try to save a pdf with a Unicode character in its name (WindowsXP 32bit). I don't really know if or where this function is used otherwise, but the change removed the annoying Dialog that popped up everytime I tried to save a pdf ;-)

Author:  Karill [ Fri Oct 14, 2011 7:21 am ]
Post subject:  Re: Raw string contains invalid character with a value > 255

I don't think that it should be like you think.

Debug.Assert shows this "annoying Dialog that popped up everytime" when the assertion returns false.
Analyzing the message of the assertion-error the Debug.Assert provided here seems correct.

if((unt)chars[charIndex] < 256) is false, when character as uint is greater then 255 :)

Author:  Neutron [ Fri Oct 14, 2011 9:12 am ]
Post subject:  Re: Raw string contains invalid character with a value > 255

Oops, i'm so sorry, should have checked that first :oops:

but what could be the problem (meaning why is this assertion there in the first place)? I'm just not that familiar with the lib yet. What would be the problem? It seems to work with Document.Save if the char is larger than 255?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/