Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Trying to <em>guess</em> the locale of anything is always an ongoing effort, at best. What are you using this function for? The following tests look simply wrong to me:</p> <pre><code>ok(&amp;parse_decimal("12.34") == 12.34); ok(&amp;parse_decimal("12.345") == 12345); </code></pre> <p>If I were parsing a single document with values on it I would be very irritated to find this result.</p> <p>I would design this function with some knobs and dials in the package to use either the locale information (using <a href="http://perldoc.perl.org/perllocale.html#The-localeconv-function" rel="nofollow noreferrer">localeconv()</a>) or ad-hoc values (like in <a href="https://stackoverflow.com/questions/1487629/regexp-perl-code-for-handling-both-dots-and-commas-as-valid-decimal-separators/1487663#1487663">this answer</a>.)</p> <p><strong>Edit:</strong> Okay, let me try to explain it better. For "single source" I mean a context or scope delimiter. I know you can import from different sources; that's the very nature of importing data. We also know that we cannot know beforehand the encoding of these different sources.</p> <p>What I would do is to is to do a preliminary scan of the file being imported (just taking a sample, not reading it whole) and check the numeric values. If I can determine the locale from the sample, then I would try to import the whole file <strong>using the same locale</strong>. To me, one file is a single source, and I wouldn't expect it to suddenly change its locale.</p> <p>That's why I would ask again: what is the purpose of this program?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload