[postgis-devel] iconv + loader

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Jan 7 03:02:48 PST 2009


Paul Ramsey wrote:

> I just noticed that we do our character transcoding inside the loader 
> itself and "SET CLIENT_ENCODING = UTF8". Wouldn't it be a lot simpler to 
> just "SET CLIENT_ENCODING = <encoding>" and dump the strings to the 
> server to handle?
> 
> Anyone know the rationale for the current approach?
> 
> P

I'm not sure, but I'm wondering if it could be related to escaping 
characters? By converting to UTF8, we know that if we encounter an 
apostrophe in the input string, we can simply escape it by replacing it 
with \' since ASCII is a subset of UTF8. However in non-UTF8 encodings, 
we have no way of knowing what the codepoints for the backslash and 
apostrophe for a given encoding actually are :(


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list