Re: correct value for LANG variable

2005-01-22 Thread Tim Robbins
On Sat, Jan 22, 2005 at 04:52:45PM +0100, Bj?rn K?nig wrote:
 I am a bit confused. Neither de_DE.ISO-8859-1 nor
 de_DE.ISO8859-1 work properly in all cases.
 
  setenv LANG de_DE.ISO8859-1
  echo abcdef uvwxyz | tr '[a-z]' '[A-Z]'
 ABCDEF ?WXY?]

For better or worse, this is not the correct way to perform case conversion
in non-ASCII locales on FreeBSD 5 and later. See the COMPATIBILITY section
of the tr(1) manpage for more information.

 
  setenv LANG de_DE.ISO-8859-1
  echo abcdef uvwxyz | tr '[a-z]' '[A-Z]'
 ABCDEF UVWXYZ
  perl
 perl: warning: Setting locale failed.
 [lot of indignation about locale settings]

FreeBSD uses the name de_DE.ISO8859-1 instead of de_DE.ISO-8859-1.
Most base system utilities don't complain if LANG or the related LC_*
variables are invalid.

 
 I am suspicious that de_DE.UTF-8 would work correct
 with most software. Is it the only solution to don't
 use localization currently at all or should it be my
 ambition to fix this? What should be the correct
 value? I would prefer the notation ISO-8859-1, but
 even the almighty perl does not.

Setting LANG to de_DE.ISO8859-1 should work.

The alternative is UTF-8, which is understood by most text-processing
utilities in the base system (ls, wc, grep, sed, ...). However, at this
stage neither sh nor vi work correctly with UTF-8, so you would need to
replace these with (for example) bash and vim.


Tim
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: correct value for LANG variable

2005-01-22 Thread Michael Nottebrock
On Saturday, 22. January 2005 16:52, Björn König wrote:
 I am a bit confused. Neither de_DE.ISO-8859-1 nor
 de_DE.ISO8859-1 work properly in all cases.

   setenv LANG de_DE.ISO8859-1
   echo abcdef uvwxyz | tr '[a-z]' '[A-Z]'

 ABCDEF ÚWXYÝ]

This is the correct locale name, but don't use tr like that, you can't rely on 
that to work correctly with charsets which aren't symmetric in 
loweruppercase characters (it used to work at some point for the ISO8859-1
[5] locales but ceased after a POSIX related modification to tr).

Use tr [:lower:] [:upper:] instead.

-- 
   ,_,   | Michael Nottebrock   | [EMAIL PROTECTED]
 (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org


pgpILG8oAmJGV.pgp
Description: PGP signature


Re: correct value for LANG variable

2005-01-22 Thread Björn König
Tim Robbins wrote:
For better or worse, this is not the correct way to perform case conversion
in non-ASCII locales on FreeBSD 5 and later. See the COMPATIBILITY section
of the tr(1) manpage for more information.
Thanks a lot for this hint. I will pay more attention to this section.
Regards Björn
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: correct value for LANG variable

2005-01-22 Thread Bjrn Knig
Michael Nottebrock schrieb:
Use tr [:lower:] [:upper:] instead.
I was wondering about a third-party script which always
worked for years with Solaris. I just didn't realized that
this issue concerns a difference between SysV and BSD.
I tried to set another LANG string and it worked, but now
I see that it will work this way with an arbitrary string,
because it's invalid. ;-)
Björn
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: correct value for LANG variable

2005-01-22 Thread Tim Robbins
On Sat, Jan 22, 2005 at 06:29:29PM +0100, Bj?rn K?nig wrote:
 Michael Nottebrock schrieb:
 
 
 Use tr [:lower:] [:upper:] instead.
 
 I was wondering about a third-party script which always
 worked for years with Solaris. I just didn't realized that
 this issue concerns a difference between SysV and BSD.

The current behaviour of range expressions in tr was required by the
Single Unix Specification Version 2 (SUSv2). Version 3 loosened this
requirement by making these expressions unspecified in locales other
than POSIX. This means you can't use tr with range expressions in any
script intending to be portable without first setting LANG to POSIX.

For reference, the systems I know of that sort range expressions
according to the current locale are FreeBSD 5 (and later), AIX,
and Tru64. The systems I know of that don't sort are FreeBSD 4
(and earlier), GNU (coreutils), and NetBSD.


Tim
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]