Re: printf and utf-8

2009-01-28 Thread Frank Shute
On Tue, Jan 27, 2009 at 12:05:28AM +0100, Svein Halvor Halvorsen wrote: > > Chuck Swiger wrote: > >On Jan 26, 2009, at 1:58 PM, Svein Halvor Halvorsen wrote: > >>As far as I can see, printf is not calculating strings lengths > >>correctly when using utf-8 encoding. Either that, or I'm using byte

Re: printf and utf-8

2009-01-27 Thread Mel
On Monday 26 January 2009 12:58:06 Svein Halvor Halvorsen wrote: > As far as I can see, printf is not calculating strings lengths correctly > when using utf-8 encoding. Either that, or I'm using byte count, and > can't find the character count :-/ > > Eg: > > $ printf "|%-10s|" "æøå" > > |æøå|

Re: printf and utf-8

2009-01-27 Thread Thomas Dickey
On Mon, Jan 26, 2009 at 03:03:44PM -0800, Chuck Swiger wrote: > On Jan 26, 2009, at 3:05 PM, Svein Halvor Halvorsen wrote: > >Do you have a suggestion to solve the following problem without > >using printf(1): > > > >I have a text file that I want to print in a "box" on a terminal > >from a she

Re: printf and utf-8

2009-01-26 Thread Svein Halvor Halvorsen
Chuck Swiger wrote: On Jan 26, 2009, at 3:05 PM, Svein Halvor Halvorsen wrote: Do you have a suggestion to solve the following problem without using printf(1): I have a text file that I want to print in a "box" on a terminal from a shell script. Now I've padded the lines with spaces to a cert

Re: printf and utf-8

2009-01-26 Thread Chuck Swiger
On Jan 26, 2009, at 3:05 PM, Svein Halvor Halvorsen wrote: Do you have a suggestion to solve the following problem without using printf(1): I have a text file that I want to print in a "box" on a terminal from a shell script. Now I've padded the lines with spaces to a certain length using

Re: printf and utf-8

2009-01-26 Thread Svein Halvor Halvorsen
Chuck Swiger wrote: On Jan 26, 2009, at 1:58 PM, Svein Halvor Halvorsen wrote: As far as I can see, printf is not calculating strings lengths correctly when using utf-8 encoding. Either that, or I'm using byte count, and can't find the character count :-/ printf(1) explicitly states that it w

Re: printf and utf-8

2009-01-26 Thread Chuck Swiger
On Jan 26, 2009, at 1:58 PM, Svein Halvor Halvorsen wrote: As far as I can see, printf is not calculating strings lengths correctly when using utf-8 encoding. Either that, or I'm using byte count, and can't find the character count :-/ printf(1) explicitly states that it works with ASCII and