The most common "problem" with UTF-8 and string lengths is that multibyte UTF-8 characters (most often characters with diacritical marks, e.g. german umlaut or special characters like the EUR sign) get truncated in between their constituent bytes. This leads to invalid byte sequences at the "end" of strings, which picky programs gag on.
The second most common "problem" I have come across is "double translation", i.e. an ISO input strings gets converted to UTF-8 and the result is subjected to another conversion. This will lead to invalid byte sequences "in the middle of" a string, to the same effect as above. -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Tony Papadimitriou Gesendet: Dienstag, 19. Dezember 2017 21:24 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [EXTERNAL] Re: [sqlite] printf() with UTF-8 and \n \t format -----Original Message----- From: R Smith On 2017/12/19 8:37 PM, Tony Papadimitriou wrote: >> A couple of questions about printf >> >> 1. Does it work with UTF-8? If so, how? > >- Yes. >- Very nicely. I'm using SQL v3.21 and UTF-8 does not work correctly. (Not from the command line.) I tried with latest trunk and it works fine. Hmmm. Let's try with the precompiled Windows binary for v3.21.0 It works. Hmmm! (...many, many trials later...) Let's try with different default options. Ta da!!! When using the -column option (my own binary has this as default) the problem shows up. With the official default of -list option the problem is not there. And, it happens with the latest trunk, also. So, that looks like a bug. >> 2. Does it understand \n and \t? I put actual line breaks inside the >> string >which is OK if run from script file but it won’t work with >> one-liners on the >command-line.> > >The \n, \t, \r etc. are really dependent on some factors (OS etc.). Yes, I know all that. The question was if it understands them, not how they might behave depending on OS. When I use \t or \n I get actual \t and \n strings displayed instead of tabbing and advancing line, respectively. So, is there any way to advance to next line from a command line printf()? >Ryan Thanks _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0 May be privileged. May be confidential. Please delete if not the addressee. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users