[sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread Ralf Junker
Example SQL: select length(printf ('%4s', 'abc')), length(printf ('%4s', 'äöü')), length(printf ('%-4s', 'abc')), length(printf ('%-4s', 'äöü')) Output is 4, 3, 4, 3. Padding seems to take into account UTF-8 bytes instead of UTF-8 code points. Should padding not work on code points

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread Richard Hipp
On 2/17/18, Ralf Junker wrote: > Example SQL: > > select >length(printf ('%4s', 'abc')), >length(printf ('%4s', 'äöü')), >length(printf ('%-4s', 'abc')), >length(printf ('%-4s', 'äöü')) > > Output is 4, 3, 4, 3. Padding seems to take into account UTF-8 bytes >

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread J Decker
On Sat, Feb 17, 2018 at 3:36 PM, Richard Hipp wrote: > On 2/17/18, Ralf Junker wrote: > > Example SQL: > > > > select > >length(printf ('%4s', 'abc')), > >length(printf ('%4s', 'äöü')), > >length(printf ('%-4s', 'abc')), > >length(printf

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread Dominique Pellé
Richard Hipp wrote: > On 2/17/18, Ralf Junker wrote: >> Example SQL: >> >> select >>length(printf ('%4s', 'abc')), >>length(printf ('%4s', 'äöü')), >>length(printf ('%-4s', 'abc')), >>length(printf ('%-4s', 'äöü')) >> >> Output is 4, 3, 4, 3.

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread Peter Da Silva
On 2018-02-17, at 17:36, Richard Hipp wrote: > The current behavior of the printf() function in SQLite, goofy though > it may be, exactly mirrors the behavior of the printf() C function in > the standard library in this regard. > > So I'm not sure whether or not this is

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-17 Thread Cezary H. Noweta
Hello, On 2018-02-18 01:46, Peter Da Silva wrote: Printf's handling of unicode is inconsistent in other ways, too. I suspect that there's still undefined behavior floating around in there too. Even wprintf isn't entirely unsurprising: You have supplied examples which are exchanged with each