On Wed, 8 Jun 2016, Henrique Andrade wrote:
Dear Jack and Allin,
I found a problem with format specifiers and printf and sprintf.
Please take a look at the following example:
<hansl>
printf "start->%10s<-end\n", "aeiou"
printf "start->%10s<-end\n", "áéíóú"
string s1 = sprintf("start->%10s<-end\n", "aeiou")
string s2 = sprintf("start->%10s<-end\n", "áéíóú")
print s1 s2
<\hansl>
I believe Gretl is ignoring accented names when formating the output.
The input must be UTF-8 or it's not going to work correctly in gretl.
With UTF-8 input the strings come out OK, but the length specifier for
the string is tricky. We're delegating that to the C library, and so
far as the C library is concerned "%10s" means "print to a width of 10
bytes". Since each of the five accented vowels above takes 2 bytes in
UTF-8, the printed string is just 5 glyphs wide.
Allin