Thread: Unicode escape codes

Unicode escape codes

From
Chris Campbell
Date:

Hi, using Postgres 9.0.1 on Windows 7/64bit

 

I run the following SQL statement through a data connection in .net.

 

Update data1.systeminfo SET aicompanyfile='C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\acme_rockets.QBW'

 

The issue is that Postgres interprets the back slashes in the path name as escapes and errors out with "invalid unicode escape"  Okay, I get it.  Back slashes are symbols for escape codes. 

 

So my question is, what options do I have other than "swapping out" the offending back-slash for some other character, then having to remember to swap it back after I fetch the table from the database?  There must be a more elegant solution.  I do use escapes in other calls so I can't eliminate the functionality completely.

 

Oh, apologies for switching gears, just fyi, I use the pgAdminIII program and after updating to 9.0.1 from 8.4.4, I noticed that calls to help (documentation) attempt to fetch it from its old 8.4 location and errors out (No big deal I manually updated the registry). Also, from pgAdminIII, if I select Help/EnterpriseDB help, it pulls up Advanced Server 8.3 documentation?

 

Thank you for any suggestions...

 

Chris Campbell

Cascade Data Solutions, Inc.

ccampbell@CascadeDS.com

(800) 280-2090

 

Re: Unicode escape codes

From
Tom Lane
Date:
Chris Campbell <ccampbell@cascadeds.com> writes:
> Update data1.systeminfo SET aicompanyfile='C:\Users\Public\Documents\Intuit\QuickBooks\Company
Files\acme_rockets.QBW'

> The issue is that Postgres interprets the back slashes in the path name as escapes and errors out with "invalid
unicodeescape"  Okay, I get it.  Back slashes are symbols for escape codes. 

> So my question is, what options do I have other than "swapping out"
the offending back-slash for some other character, then having to
remember to swap it back after I fetch the table from the database?
There must be a more elegant solution.

You can double the backslashes ('C:\\Users...') or you can turn on
standard_conforming_strings.  The latter is best done only with
considerable testing, though, because it's likely to break anything
that knows backslashes are special.

            regards, tom lane