#35 AfmParser fails due to system localization

0.1.2.1
closed-fixed
None
1
2015-05-05
2012-04-24
ag3
No

AfmParser is dependent on system localization due to Single.parse() in AfmParser.cs at line 123

to repro: change decimal separator in system localization config to ","

StackTrace:
System.FormatException:
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
System.Single.Parse(String s, NumberStyles style, NumberFormatInfo info)
System.Single.Parse(String s)
org.pdfclown.documents.contents.fonts.AfmParser.LoadFontHeader() in PDFClown-0.1.1-Beta\PDFClown\dotNET\pdfclown.lib\src\org\pdfclown\documents\contents\fonts\AfmParser.cs:line 123
org.pdfclown.documents.contents.fonts.AfmParser.Load() in PDFClown-0.1.1-Beta\PDFClown\dotNET\pdfclown.lib\src\org\pdfclown\documents\contents\fonts\AfmParser.cs:line 94
org.pdfclown.documents.contents.fonts.AfmParser..ctor(IInputStream fontData) in PDFClown-0.1.1-Beta\PDFClown\dotNET\pdfclown.lib\src\org\pdfclown\documents\contents\fonts\AfmParser.cs:line 84
org.pdfclown.documents.contents.fonts.StandardType1Font.Load(String fontName) in PDFClown-0.1.1-Beta\PDFClown\dotNET\pdfclown.lib\src\org\pdfclown\documents\contents\fonts\StandardType1Font.cs:line 223

Discussion

  • Stefano Chizzolini

    • assigned_to: nobody --> stechio
     
  • Stefano Chizzolini

    Contrary to Java, .NET string parsing is locale-based by default, thus the C# porting didn't handle properly decimal values. The fix applied invariant parsing throughout the code base.

    Fixed on 0.1.2-Fix branch (rev 210) and 0.2.0 trunk (rev 211).

     
  • Stefano Chizzolini

    • status: open --> closed-fixed
    • Group: --> 0.1.2.1
    • Priority: 5 --> 1
     

Log in to post a comment.