mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
use invariant culture for parsing all numbers #37
This commit is contained in:
@@ -56,9 +56,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
value = decimal.Parse(characters.ToString(), NumberStyles.Any);
|
||||
value = decimal.Parse(characters.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
|
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Encryption;
|
||||
@@ -105,7 +106,7 @@
|
||||
{
|
||||
var match = EndsWithNumberRegex.Match(op.Data);
|
||||
|
||||
if (match.Success && int.TryParse(match.Value, out var number))
|
||||
if (match.Success && int.TryParse(match.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
|
||||
{
|
||||
startPosition = previousTokenPositions[0] + match.Index;
|
||||
objectNumber = new NumericToken(number);
|
||||
|
@@ -40,7 +40,7 @@
|
||||
{
|
||||
if (char.IsNumber(part[0]) || part[0] == '-')
|
||||
{
|
||||
if (decimal.TryParse(part, NumberStyles.AllowLeadingSign, null, out var value))
|
||||
if (decimal.TryParse(part, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out var value))
|
||||
{
|
||||
tokens.Add(new NumericToken(value));
|
||||
}
|
||||
|
Reference in New Issue
Block a user