Re: translating foreign data

2018-06-26 Thread Stefan Ram
To: Richard Damon From: "Stefan Ram" To: Richard Damon From: r...@zedat.fu-berlin.de (Stefan Ram) Richard Damon writes: >Now, if I have a parser that doesn't use the locale, but some other rule >base than I just need to provide it with the right rules, which is >basically just defining the

Re: translating foreign data

2018-06-26 Thread Marko Rauhamaa
To: Richard Damon From: "Marko Rauhamaa" To: Richard Damon From: Marko Rauhamaa Richard Damon : > On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >> Richard Damon : >> >>> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: I always know my locale. The locale is tied to the human user. >>> No, it

Re: translating foreign data

2018-06-26 Thread Marko Rauhamaa
To: Richard Damon From: "Marko Rauhamaa" To: Richard Damon From: Marko Rauhamaa Richard Damon : > On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >> I always know my locale. The locale is tied to the human user. > No, it should be tied to the data you are processing. In computing, a locale

Re: translating foreign data

2018-06-26 Thread Marko Rauhamaa
To: Richard Damon From: "Marko Rauhamaa" To: Richard Damon From: Marko Rauhamaa Richard Damon : > If you know the Locale, then you do know what the decimal separator > is, as that is part of what a locale defines. I don't know what that sentence means. > The issue is that if you just

Re: translating foreign data

2018-06-26 Thread Steven D'Aprano
From: "Steven D'Aprano" From: Steven D'Aprano On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > If you know the Locale, then you do know what the decimal separator is, > as that is part of what a locale defines. A locale defines a set of common cultural conventions. It doesn't

Re: translating foreign data

2018-06-26 Thread Richard Damon
From: "Richard Damon" From: Richard Damon On 6/22/18 11:21 PM, Steven D'Aprano wrote: > On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > >> Steven D'Aprano writes: >> >>> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>> >> The code page remark is curious. Will some

Re: translating foreign data

2018-06-26 Thread Steven D'Aprano
From: "Steven D'Aprano" From: Steven D'Aprano On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > Steven D'Aprano writes: > >> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >> > The code page remark is curious. Will some "code pages" have digits > that are not

Re: translating foreign data

2018-06-26 Thread Ben Bacarisse
To: Steven D'Aprano From: "Ben Bacarisse" To: Steven D'Aprano From: Ben Bacarisse Steven D'Aprano writes: > On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: > The code page remark is curious. Will some "code pages" have digits that are not ASCII digits? >>> >>> Good

Re: translating foreign data

2018-06-26 Thread Richard Damon
From: Richard Damon On 6/23/18 10:44 PM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > >> If you have more than just a number representing a value in the locale >> currency, you can't ask the locale how to present/accept it. > You're the only one saying that

Re: translating foreign data

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Sun, Jun 24, 2018 at 1:23 PM, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 12:53:49 +1000, Chris Angelico wrote: > > [...] >>> Okay, you want a bit-pattern. In hex: >>> >>> '0x313030e282ac' > [...] > >> Hmm. Actually, I'm a bit confused. >> > hex("100ΓΘ¼".encode())

Re: translating foreign data

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sun, 24 Jun 2018 12:53:49 +1000, Chris Angelico wrote: [...] >> Okay, you want a bit-pattern. In hex: >> >> '0x313030e282ac' [...] > Hmm. Actually, I'm a bit confused. > hex("100ΓΘ¼".encode()) > Traceback (most recent call last): > File "", line 1, in >

Re: translating foreign data

2018-06-25 Thread Chris Angelico
From: Chris Angelico On Sun, Jun 24, 2018 at 12:44 PM, Steven D'Aprano wrote: > You're joking, right? You can't possibly be so ignorant as to actually > believe that. You have, right in front of you, a news post or email > containing the text string "100ΓΘ¼", and yet you are writing apparently

Re: translating foreign data

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > If you have more than just a number representing a value in the locale > currency, you can't ask the locale how to present/accept it. You're the only one saying that it has to be handled by the locale. -- Steven

Re: translating foreign data

2018-06-25 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 17:05:17 -0400, Richard Damon wrote: > On 6/23/18 11:27 AM, Steven D'Aprano wrote: >> On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: >> >>> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: Ok. Here's a value for you: 100ΓΘ¼ [...]

Re: translating foreign data

2018-06-25 Thread Richard Damon
From: Richard Damon On 6/23/18 5:31 PM, Ben Finney wrote: > Richard Damon writes: > >> On 6/23/18 11:27 AM, Steven D'Aprano wrote: On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon wrote: >> Data presented to the user should normally use his locale >> (unless he has

Re: translating foreign data

2018-06-25 Thread Ben Finney
From: Ben Finney Richard Damon writes: > On 6/23/18 11:27 AM, Steven D'Aprano wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > >>> Richard Damon wrote: > >>> > Data presented to the user should normally use his locale > >>> > (unless he has specified something different). > >>> > >>>

Re: translating foreign data

2018-06-25 Thread Richard Damon
From: Richard Damon On 6/23/18 11:27 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>> Ok. Here's a value for you: >>> >>> 100ΓΘ¼ >>> >>> I see '1', '0', '0', 'ΓΘ¼'. What do you see in your locale

Re: translating foreign data

2018-06-24 Thread Stefan Ram
To: Richard Damon From: r...@zedat.fu-berlin.de (Stefan Ram) Richard Damon writes: >Now, if I have a parser that doesn't use the locale, but some other rule >base than I just need to provide it with the right rules, which is >basically just defining the right locale. Here's an example C++

Re: translating foreign data

2018-06-24 Thread Peter J. Holzer
From: "Peter J. Holzer" --b2wbudmypdkmv7il Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-06-23 12:11:34 -0400, Richard Damon wrote: > On 6/23/18 10:05 AM, Peter J. Holzer wrote: > > On 2018-06-23 08:41:38 -0400,

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 11:44 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>> If you know the Locale, then you do know what the

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 10:05 AM, Peter J. Holzer wrote: > On 2018-06-23 08:41:38 -0400, Richard Damon wrote: >> On 6/23/18 8:28 AM, Peter J. Holzer wrote: >>> On 2018-06-23 08:12:52 -0400, Richard Damon wrote: On 6/23/18 7:46 AM, Steven D'Aprano wrote: > If I'm in Australia,

Re: translating foreign data

2018-06-24 Thread Peter J. Holzer
From: "Peter J. Holzer" --ngg56dmsr6vcxzs5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-06-23 12:41:33 -0400, Richard Damon wrote: > On 6/23/18 11:44 AM, Steven D'Aprano wrote: > > You're assuming that there will be

Re: translating foreign data

2018-06-24 Thread Dennis Lee Bieber
From: Dennis Lee Bieber On Sat, 23 Jun 2018 15:44:14 + (UTC), Steven D'Aprano declaimed the following: >1.234.567,012345678 > >which is understandable to anyone who is aware of the possibility that >comma may mean decimal separator and period the thousands separator. > Or it is

Re: translating foreign data

2018-06-24 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > On 6/23/18 7:46 AM, Steven D'Aprano wrote: >> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >> >>> If you know the Locale, then you do know what the decimal separator >>> is, as that is part of what a

Re: translating foreign data

2018-06-24 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >> Ok. Here's a value for you: >> >> 100ΓΘ¼ >> >> I see '1', '0', '0', 'ΓΘ¼'. What do you see in your locale (LC_MONETARY)? > > If I processed that on my system I

Re: translating foreign data

2018-06-24 Thread Peter J. Holzer
From: "Peter J. Holzer" --p4u6dkqn7e5fhtwt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-06-23 08:41:38 -0400, Richard Damon wrote: > On 6/23/18 8:28 AM, Peter J. Holzer wrote: > > On 2018-06-23 08:12:52 -0400,

Re: translating foreign data

2018-06-24 Thread Peter J. Holzer
From: "Peter J. Holzer" --jbhqoow7s7225t6e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-06-23 16:05:49 +0200, Peter J. Holzer wrote: > I don't think that's a useful way to look at it. "Locale" in > (non-technical)

Re: translating foreign data

2018-06-24 Thread Marko Rauhamaa
To: Richard Damon From: Marko Rauhamaa Richard Damon : > On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >> Richard Damon : >> >>> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: I always know my locale. The locale is tied to the human user. >>> No, it should be tied to the data you are processing.

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon : > >> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >>> I always know my locale. The locale is tied to the human user. >> No, it should be tied to the data you are processing. >In computing, a locale is a set of

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 8:03 AM, Marko Rauhamaa wrote: > Richard Damon : >> If you know the Locale, then you do know what the decimal separator >> is, as that is part of what a locale defines. > I don't know what that sentence means. When you set the locale > >> The issue is that if you

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 7:46 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > >> If you know the Locale, then you do know what the decimal separator is, >> as that is part of what a locale defines. > A locale defines a set of common cultural

Re: translating foreign data

2018-06-24 Thread Steven D'Aprano
From: Steven D'Aprano On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > If you know the Locale, then you do know what the decimal separator is, > as that is part of what a locale defines. A locale defines a set of common cultural conventions. It doesn't mandate the actual conventions

Re: translating foreign data

2018-06-24 Thread Marko Rauhamaa
To: Richard Damon From: Marko Rauhamaa Richard Damon : > On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >> I always know my locale. The locale is tied to the human user. > No, it should be tied to the data you are processing. In computing, a locale is a set of parameters that defines the

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 8:28 AM, Peter J. Holzer wrote: > On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: If you know the Locale, then you do know what the decimal separator

Re: translating foreign data

2018-06-24 Thread Peter J. Holzer
From: "Peter J. Holzer" --drblskvcly73v23o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-06-23 08:12:52 -0400, Richard Damon wrote: > On 6/23/18 7:46 AM, Steven D'Aprano wrote: > > On Sat, 23 Jun 2018 06:26:22 -0400,

Re: translating foreign data

2018-06-24 Thread Marko Rauhamaa
To: Richard Damon From: Marko Rauhamaa Richard Damon : > If you know the Locale, then you do know what the decimal separator > is, as that is part of what a locale defines. I don't know what that sentence means. > The issue is that if you just know the encoding, you don't necessarily > know

Re: translating foreign data

2018-06-24 Thread Steven D'Aprano
From: Steven D'Aprano On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > Steven D'Aprano writes: > >> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >> > The code page remark is curious. Will some "code pages" have digits > that are not ASCII digits? Good

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/22/18 11:21 PM, Steven D'Aprano wrote: > On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > >> Steven D'Aprano writes: >> >>> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>> >> The code page remark is curious. Will some "code pages" have digits

Re: translating foreign data

2018-06-24 Thread Ben Bacarisse
To: Steven D'Aprano From: Ben Bacarisse Steven D'Aprano writes: > On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: > The code page remark is curious. Will some "code pages" have digits that are not ASCII digits? >>> >>> Good question. I have no idea. >> >> It's much more

Re: translating foreign data

2018-06-24 Thread Richard Damon
On 6/23/18 10:44 PM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > >> If you have more than just a number representing a value in the locale >> currency, you can't ask the locale how to present/accept it. > You're the only one saying that it has to be handled

Re: translating foreign data

2018-06-23 Thread Chris Angelico
On Sun, Jun 24, 2018 at 1:23 PM, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 12:53:49 +1000, Chris Angelico wrote: > > [...] >>> Okay, you want a bit-pattern. In hex: >>> >>> '0x313030e282ac' > [...] > >> Hmm. Actually, I'm a bit confused. >> > hex("100€".encode()) >> Traceback (most recent

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sun, 24 Jun 2018 12:53:49 +1000, Chris Angelico wrote: [...] >> Okay, you want a bit-pattern. In hex: >> >> '0x313030e282ac' [...] > Hmm. Actually, I'm a bit confused. > hex("100€".encode()) > Traceback (most recent call last): > File "", line 1, in > TypeError: 'bytes' object cannot

Re: translating foreign data

2018-06-23 Thread Chris Angelico
On Sun, Jun 24, 2018 at 12:44 PM, Steven D'Aprano wrote: > You're joking, right? You can't possibly be so ignorant as to actually > believe that. You have, right in front of you, a news post or email > containing the text string "100€", and yet you are writing apparently in > full seriousness

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > If you have more than just a number representing a value in the locale > currency, you can't ask the locale how to present/accept it. You're the only one saying that it has to be handled by the locale. -- Steven D'Aprano "Ever since I

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2018 17:05:17 -0400, Richard Damon wrote: > On 6/23/18 11:27 AM, Steven D'Aprano wrote: >> On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: >> >>> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: Ok. Here's a value for you: 100€ [...] > Locale based currency

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 5:31 PM, Ben Finney wrote: > Richard Damon writes: > >> On 6/23/18 11:27 AM, Steven D'Aprano wrote: On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon wrote: >> Data presented to the user should normally use his locale >> (unless he has specified something

Re: translating foreign data

2018-06-23 Thread Ben Finney
Richard Damon writes: > On 6/23/18 11:27 AM, Steven D'Aprano wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > >>> Richard Damon wrote: > >>> > Data presented to the user should normally use his locale > >>> > (unless he has specified something different). > >>> > >>> Ok. Here's a value

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 11:27 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>> Ok. Here's a value for you: >>> >>> 100€ >>> >>> I see '1', '0', '0', '€'. What do you see in your locale (LC_MONETARY)? >> If I processed

Re: translating foreign data

2018-06-23 Thread Peter J. Holzer
On 2018-06-23 12:41:33 -0400, Richard Damon wrote: > On 6/23/18 11:44 AM, Steven D'Aprano wrote: > > You're assuming that there will be a misinterpretation. That's an absurd > > assumption to make. There might be, of course, but the documentation for > > my document might be clear that comma is

Re: translating foreign data

2018-06-23 Thread Peter J. Holzer
On 2018-06-23 12:11:34 -0400, Richard Damon wrote: > On 6/23/18 10:05 AM, Peter J. Holzer wrote: > > On 2018-06-23 08:41:38 -0400, Richard Damon wrote: > >> Once you open the Locale can of worms, EVERYTHING has a locale, to say > >> you aren't using a locale is to say you are writing > >>

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 11:44 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>> If you know the Locale, then you do know what the decimal separator is,

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 10:05 AM, Peter J. Holzer wrote: > On 2018-06-23 08:41:38 -0400, Richard Damon wrote: >> On 6/23/18 8:28 AM, Peter J. Holzer wrote: >>> On 2018-06-23 08:12:52 -0400, Richard Damon wrote: On 6/23/18 7:46 AM, Steven D'Aprano wrote: > If I'm in Australia, using the en-AU locale,

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > On 6/23/18 7:46 AM, Steven D'Aprano wrote: >> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >> >>> If you know the Locale, then you do know what the decimal separator >>> is, as that is part of what a locale defines. >> A

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >> Ok. Here's a value for you: >> >> 100€ >> >> I see '1', '0', '0', '€'. What do you see in your locale (LC_MONETARY)? > > If I processed that on my system I would either get $100, or an

Re: translating foreign data

2018-06-23 Thread Peter J. Holzer
On 2018-06-23 16:05:49 +0200, Peter J. Holzer wrote: > I don't think that's a useful way to look at it. "Locale" in > (non-technical) English means "place" or "site". The idea behind the > locale concept is that some conventions (e.g. how to write numbers or > how to write strings) depend on the

Re: translating foreign data

2018-06-23 Thread Marko Rauhamaa
Richard Damon : > On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >> Richard Damon : >> >>> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: I always know my locale. The locale is tied to the human user. >>> No, it should be tied to the data you are processing. >>In computing, a locale is a set of

Re: translating foreign data

2018-06-23 Thread Peter J. Holzer
On 2018-06-23 08:41:38 -0400, Richard Damon wrote: > On 6/23/18 8:28 AM, Peter J. Holzer wrote: > > On 2018-06-23 08:12:52 -0400, Richard Damon wrote: > >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: > >>> If I'm in Australia, using the en-AU locale, nevertheless I can generate > >>> a file using

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon : > >> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >>> I always know my locale. The locale is tied to the human user. >> No, it should be tied to the data you are processing. >In computing, a locale is a set of parameters that defines the

Re: translating foreign data

2018-06-23 Thread Marko Rauhamaa
Richard Damon : > On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >> I always know my locale. The locale is tied to the human user. > No, it should be tied to the data you are processing. In computing, a locale is a set of parameters that defines the user's language, region and any special

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 8:28 AM, Peter J. Holzer wrote: > On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: If you know the Locale, then you do know what the decimal separator is, as that is

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 8:03 AM, Marko Rauhamaa wrote: > Richard Damon : >> If you know the Locale, then you do know what the decimal separator >> is, as that is part of what a locale defines. > I don't know what that sentence means. When you set the locale > >> The issue is that if you just know the encoding,

Re: translating foreign data

2018-06-23 Thread Peter J. Holzer
On 2018-06-23 08:12:52 -0400, Richard Damon wrote: > On 6/23/18 7:46 AM, Steven D'Aprano wrote: > > On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > >> If you know the Locale, then you do know what the decimal separator is, > >> as that is part of what a locale defines. > > A locale

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 7:46 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > >> If you know the Locale, then you do know what the decimal separator is, >> as that is part of what a locale defines. > A locale defines a set of common cultural conventions. It doesn't

Re: translating foreign data

2018-06-23 Thread Marko Rauhamaa
Richard Damon : > If you know the Locale, then you do know what the decimal separator > is, as that is part of what a locale defines. I don't know what that sentence means. > The issue is that if you just know the encoding, you don't necessarily > know the locale. I always know my locale. The

Re: translating foreign data

2018-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > If you know the Locale, then you do know what the decimal separator is, > as that is part of what a locale defines. A locale defines a set of common cultural conventions. It doesn't mandate the actual conventions in use in any specific

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/22/18 11:21 PM, Steven D'Aprano wrote: > On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > >> Steven D'Aprano writes: >> >>> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>> >> The code page remark is curious. Will some "code pages" have digits >> that are not

Re: translating foreign data

2018-06-22 Thread Steven D'Aprano
On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > Steven D'Aprano writes: > >> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >> > The code page remark is curious. Will some "code pages" have digits > that are not ASCII digits? Good question. I have no

Re: translating foreign data

2018-06-22 Thread Ben Bacarisse
Steven D'Aprano writes: > On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: > The code page remark is curious. Will some "code pages" have digits that are not ASCII digits? >>> >>> Good question. I have no idea. >> >> It's much more of an open question than I thought. > >

Re: translating foreign data

2018-06-22 Thread Richard Damon
On 6/22/18 4:43 AM, Ethan Furman wrote: > On 06/21/2018 01:20 PM, Ben Bacarisse wrote: > >> The code page remark is curious.  Will some "code pages" have digits >> that are not ASCII digits? > > Good question.  I have no idea.  I get the appropriate decoder/encoder > based on the code page

Re: translating foreign data

2018-06-22 Thread Steven D'Aprano
On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>> The code page remark is curious. Will some "code pages" have digits >>> that are not ASCII digits? >> >> Good question. I have no idea. > > It's much more of an open question than I thought. Nah, Python already solves that for you:

Re: translating foreign data

2018-06-22 Thread Ben Bacarisse
Ethan Furman writes: > On 06/21/2018 01:20 PM, Ben Bacarisse wrote: >> You say in a followup that you don't need to worry about digit grouping >> marks (like thousands separators) so I'm not sure what the problem is. >> Can't you just replace ',' with '.' a proceed as if you had only one >>

Re: translating foreign data

2018-06-22 Thread Steven D'Aprano
On Fri, 22 Jun 2018 01:43:56 -0700, Ethan Furman wrote: >> You say in a followup that you don't need to worry about digit grouping >> marks (like thousands separators) so I'm not sure what the problem is. >> Can't you just replace ',' with '.' a proceed as if you had only one >> representation? >

Re: translating foreign data

2018-06-22 Thread Ethan Furman
On 06/21/2018 01:20 PM, Ben Bacarisse wrote: Ethan Furman writes: I need to translate numeric data in a string format into a binary format. I know there are at least two different methods of representing parts less that 1, such as "10.5" and "10,5". The data is encoded using code pages, and

Re: translating foreign data

2018-06-21 Thread Cameron Simpson
On 21Jun2018 10:12, Ethan Furman wrote: I need to translate numeric data in a string format into a binary format. I know there are at least two different methods of representing parts less that 1, such as "10.5" and "10,5". The data is encoded using code pages, and can vary depending on the

Re: translating foreign data

2018-06-21 Thread Gregory Ewing
George Fischhof wrote: - if you found only one type, then that is the decimal Only if you're sure that all numbers contain a decimal separator. Otherwise there's no way to be sure in general. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: translating foreign data

2018-06-21 Thread George Fischhof
Peter Otten <__pete...@web.de> ezt írta (időpont: 2018. jún. 21., Cs, 22:45): > Ethan Furman wrote: > > > I need to translate numeric data in a string format into a binary > format. > > I know there are at least two different > > methods of representing parts less that 1, such as "10.5" and

Re: translating foreign data

2018-06-21 Thread Peter Otten
Ethan Furman wrote: > I need to translate numeric data in a string format into a binary format. > I know there are at least two different > methods of representing parts less that 1, such as "10.5" and "10,5". The > data is encoded using code pages, and can vary depending on the file being >

Re: translating foreign data

2018-06-21 Thread Ben Bacarisse
Ethan Furman writes: > I need to translate numeric data in a string format into a binary > format. I know there are at least two different methods of > representing parts less that 1, such as "10.5" and "10,5". The data > is encoded using code pages, and can vary depending on the file being >

Re: translating foreign data

2018-06-21 Thread Ethan Furman
On 06/21/2018 12:07 PM, codewiz...@gmail.com wrote: On Thursday, June 21, 2018 at 1:08:35 PM UTC-4, Ethan Furman wrote: I need to translate numeric data in a string format into a binary format. I know there are at least two different methods of representing parts less that 1, such as "10.5"

Re: translating foreign data

2018-06-21 Thread Ethan Furman
On 06/21/2018 10:36 AM, Peter Pearson wrote: On Thu, 21 Jun 2018 10:12:27 -0700, Ethan Furman wrote: I need to translate numeric data in a string format into a binary format. I know there are at least two different methods of representing parts less that 1, such as "10.5" and "10,5". The

Re: translating foreign data

2018-06-21 Thread codewizard
On Thursday, June 21, 2018 at 1:08:35 PM UTC-4, Ethan Furman wrote: > I need to translate numeric data in a string format into a binary format. I > know there are at least two different > methods of representing parts less that 1, such as "10.5" and "10,5". The > data is encoded using code

Re: translating foreign data

2018-06-21 Thread Peter Pearson
On Thu, 21 Jun 2018 10:12:27 -0700, Ethan Furman wrote: > I need to translate numeric data in a string format into a binary > format. I know there are at least two different methods of > representing parts less that 1, such as "10.5" and "10,5". The data > is encoded using code pages, and can

translating foreign data

2018-06-21 Thread Ethan Furman
I need to translate numeric data in a string format into a binary format. I know there are at least two different methods of representing parts less that 1, such as "10.5" and "10,5". The data is encoded using code pages, and can vary depending on the file being read (so I can't rely on