pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11523: Regular expressions work differently on different platforms
2+ messages / 2 participants
[nested] [flat]

* BUG #11523: Regular expressions work differently on different platforms
@ 2014-09-30 09:56  dmigowski@ikoffice.de
  0 siblings, 1 reply; 2+ messages in thread

From: dmigowski@ikoffice.de @ 2014-09-30 09:56 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11523
Logged by:          Daniel Migowski
Email address:      dmigowski@ikoffice.de
PostgreSQL version: 9.1.2
Operating system:   Debian Linux 6.0.6 + Windows 7
Description:        

I recently found that regular expressions, or specifically the [:space:]
shorthand escape work differntly on Windows and Linux. On Linux the
non-brakeable space is not included in the shorthand escape, on windows it
is. The following statement is therefore true on Windows and false on
Linux:

    select convert_from(E'\\xA0'::bytea,'ISO8859-1') ~ '\s'

This brakes email validation here, and the insert of a linux created backup
into my windows machine. Is it possible to fix that? Is there a reason that
UTF-8 on Linux differs from UTF-8 on Windows? 


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #11523: Regular expressions work differently on different platforms
@ 2014-09-30 13:58  Tom Lane <tgl@sss.pgh.pa.us>
  parent: dmigowski@ikoffice.de
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2014-09-30 13:58 UTC (permalink / raw)
  To: dmigowski@ikoffice.de; +Cc: pgsql-bugs

dmigowski@ikoffice.de writes:
> I recently found that regular expressions, or specifically the [:space:]
> shorthand escape work differntly on Windows and Linux. On Linux the
> non-brakeable space is not included in the shorthand escape, on windows it
> is.

That would depend on what locale you're using for LC_CTYPE.  We can't do
much about the fact that locale definitions vary across platforms.  In
principle you could use C locale, which *is* standardized, but that cure
may be worse than the disease for your purposes.

You could always spell it out with whatever set of characters you consider
whitespace: [ \t\r\n] or something like that.  For purposes like email
address validation, the set of whitespace characters allowed by the
relevant RFCs is probably smaller than most locales' [:space:] anyway.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-09-30 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 09:56 BUG #11523: Regular expressions work differently on different platforms dmigowski@ikoffice.de
2014-09-30 13:58 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox