Re: [HACKERS] Lexing with different charsets

2004-04-14 Thread Dennis Bjorklund
On Wed, 14 Apr 2004, Fabien COELHO wrote: > printf("SELECT * FROM foo WHERE field1 = '%s'", >latin1_to_database_encoding(...)); And how do you do this if the database encoding is latin2? You can not convert latin1 to latin2. The specification was written like this to handle things like

Re: [HACKERS] Lexing with different charsets

2004-04-14 Thread Fabien COELHO
> > I cannot see where I could use such a feature. > > Applications usually generate queries. Sure. > So you can do things like > > printf ("SELECT * FROM foo WHERE field1 = _latin1'%s';", my_latin1_data); Hmmm... I guess the following was too complicated. You need a library for conversion. You

Re: [HACKERS] Lexing with different charsets

2004-04-14 Thread Dennis Bjorklund
On Wed, 14 Apr 2004, Fabien COELHO wrote: > > ... WHERE field1 = _latin1'FooBar' and field2 = _utf8'Åäö' > > > > different charsets or this is not going to work very well. > > What "editor" or terminal is supposed to be able to generate text in > different encodings depending on the part of the

Re: [HACKERS] Lexing with different charsets

2004-04-14 Thread Fabien COELHO
> My next question is about lexing. The spec says that one can use strings > of different charsets in the queries, like: > > ... WHERE field1 = _latin1'FooBar' and field2 = _utf8'Åäö' > > different charsets or this is not going to work very well. Sorry for this maybe stupid question about an mu

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Stephan Szabo
On Wed, 14 Apr 2004, Tatsuo Ishii wrote: > > I've spent some more time reading specs today. Together with Peter E's > > explanataion (Thanks!) I think I've got a farily good understanding of the > > parts talking about locales now. > > > > My next question is about lexing. The spec says that one

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Tatsuo Ishii
> I've spent some more time reading specs today. Together with Peter E's > explanataion (Thanks!) I think I've got a farily good understanding of the > parts talking about locales now. > > My next question is about lexing. The spec says that one can use strings > of different charsets in the quer

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Dennis Bjorklund
On Tue, 13 Apr 2004, Tom Lane wrote: > We could possibly do it if we restrict to ASCII-superset character sets > (not UTF-16 for instance), so that the string quoting boundaries can be > found without hardwired knowledge about every character set. It's a reasonable compromise I guess. One can sti

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Yeah. I'm not sure that we're ever going to support that part of the >> spec; doing so would break too many useful things without adding very >> much useful functionality. > Like what? The first things that came to mind were losin

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Peter Eisentraut
Tom Lane wrote: > Dennis Bjorklund <[EMAIL PROTECTED]> writes: > > My next question is about lexing. The spec says that one can use > > strings of different charsets in the queries, like: > > ... WHERE field1 = _latin1'FooBar' and field2 = _utf8'Åäö' > > I can see that the lexer either needs to b

Re: [HACKERS] Lexing with different charsets

2004-04-13 Thread Tom Lane
Dennis Bjorklund <[EMAIL PROTECTED]> writes: > My next question is about lexing. The spec says that one can use strings > of different charsets in the queries, like: > ... WHERE field1 = _latin1'FooBar' and field2 = _utf8'Åäö' > I can see that the lexer either needs to be taught about all the >