Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-18 Thread Tom Lane
Robert Haas writes: > Anyway, it's not really important enough to me to have a protracted > argument about it. Let's wait and see if anyone else has an opinion, > and perhaps a consensus will emerge. Well, nobody else seems to care, so I went ahead and committed the shorter form of the patch, ie

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-15 Thread Robert Haas
On Sun, Aug 15, 2010 at 10:20 PM, Tom Lane wrote: > Robert Haas writes: >> On Sun, Aug 15, 2010 at 7:49 PM, Tom Lane wrote: >>> FWIW, I *don't* like this version, specifically because it fails to >>> utilize the pg_wchar datatype.  The function in question is neither big >>> enough nor mutable e

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-15 Thread Tom Lane
Robert Haas writes: > On Sun, Aug 15, 2010 at 7:49 PM, Tom Lane wrote: >> FWIW, I *don't* like this version, specifically because it fails to >> utilize the pg_wchar datatype.  The function in question is neither big >> enough nor mutable enough that it's urgent to not duplicate it between >> the

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-15 Thread Robert Haas
On Sun, Aug 15, 2010 at 7:49 PM, Tom Lane wrote: > Joseph Adams writes: >> I've attached another patch that moves utf8_to_unicode to src/port per >> Robert Haas's suggestion. > >> This patch itself is not quite as elegant as the first one because it >> puts platform-independent code that "belongs

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-15 Thread Tom Lane
Joseph Adams writes: > I've attached another patch that moves utf8_to_unicode to src/port per > Robert Haas's suggestion. > This patch itself is not quite as elegant as the first one because it > puts platform-independent code that "belongs" in wchar.c into src/port > . It also uses unsigned int

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Robert Haas
On Fri, Aug 13, 2010 at 12:11 PM, Alvaro Herrera wrote: > src/include/port.h? Oh, hey, look at that. Any thought on what to about the fact that our two existing copies of utf2ucs() don't match? (one tests against 0xf8 where the other against 0xf0) -- Robert Haas EnterpriseDB: http://www.enter

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Tom Lane
Robert Haas writes: > On Fri, Aug 13, 2010 at 1:50 PM, Tom Lane wrote: >> AFAICS the version in mbprint.c is flat out wrong, and the only reason >> nobody's noticed is that it should never get passed a more-than-4-byte >> sequence anyway. > Should we fix it, then, and if so how far should we go

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Robert Haas
On Fri, Aug 13, 2010 at 1:50 PM, Tom Lane wrote: > Alvaro Herrera writes: >> Excerpts from Robert Haas's message of vie ago 13 12:50:13 -0400 2010: >>> Oh, hey, look at that.  Any thought on what to about the fact that our >>> two existing copies of utf2ucs() don't match?  (one tests against 0xf8

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Tom Lane
Alvaro Herrera writes: > Excerpts from Robert Haas's message of vie ago 13 12:50:13 -0400 2010: >> Oh, hey, look at that. Any thought on what to about the fact that our >> two existing copies of utf2ucs() don't match? (one tests against 0xf8 >> where the other against 0xf0) > I'm not sure why i

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Alvaro Herrera
Excerpts from Robert Haas's message of vie ago 13 12:50:13 -0400 2010: > On Fri, Aug 13, 2010 at 12:11 PM, Alvaro Herrera > wrote: > > src/include/port.h? > > Oh, hey, look at that. Any thought on what to about the fact that our > two existing copies of utf2ucs() don't match? (one tests against

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Alvaro Herrera
Excerpts from Robert Haas's message of vie ago 13 12:00:32 -0400 2010: > On Fri, Aug 13, 2010 at 3:12 AM, Joseph Adams > wrote: > > I've attached another patch that moves utf8_to_unicode to src/port per > > Robert Haas's suggestion. > > > > This patch itself is not quite as elegant as the first on

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Robert Haas
On Fri, Aug 13, 2010 at 3:12 AM, Joseph Adams wrote: > I've attached another patch that moves utf8_to_unicode to src/port per > Robert Haas's suggestion. > > This patch itself is not quite as elegant as the first one because it > puts platform-independent code that "belongs" in wchar.c into src/po

Re: [HACKERS] patch: utf8_to_unicode (trivial)

2010-08-13 Thread Joseph Adams
On Tue, Jul 27, 2010 at 1:31 PM, Robert Haas wrote: > On Sat, Jul 24, 2010 at 10:34 PM, Joseph Adams > wrote: >> In src/include/mb/pg_wchar.h , there is a function unicode_to_utf8 , >> but no corresponding utf8_to_unicode .  However, there is a static >> function called utf2ucs that does what utf

[HACKERS] patch: utf8_to_unicode (trivial)

2010-07-24 Thread Joseph Adams
In src/include/mb/pg_wchar.h , there is a function unicode_to_utf8 , but no corresponding utf8_to_unicode . However, there is a static function called utf2ucs that does what utf8_to_unicode would do. I'd like this function to be available because the JSON code needs to convert UTF-8 to and from U