[Bug 6356] Unicode support logic badly broken
bugzilla at busybox.net
bugzilla at busybox.net
Sun Aug 3 00:23:40 UTC 2014
https://bugs.busybox.net/show_bug.cgi?id=6356
--- Comment #3 from BitJam at gmail.com 2014-08-03 00:23:38 UTC ---
I've hit a similar problem when trying to use a busybox shell script as /init
in an initrd (initramfs). What's frustrating is that the environment is set
by the bootloader (both isolinux and legacy grub) according to the boot
parameters given by the user. That would be okay except for the fact that in
this (not uncommon) situation the LANG variable appears to be somewhat
immutable.
I just need the length of unicode strings. The following code to count the
number of characters in a string works consistently in my development
environment regardless of what LANG is set to in the calling environment but
fails when run in the /init script in an initrd:
echo -n "$1" | LANG=en_US.UTF-8 sed 's/./x/g' | wc -c
Likewise exporting LANG does not help:
export LANG=en_US.UTF-8
Someone else ran into this problem and submitted a patch to force the LANG
variable to always be en_US.UTF-8 in order to get consistent unicode support:
http://lists.busybox.net/pipermail/busybox/2014-June/081021.html
> Exporting LANG in rcS didnt have an effect.
If I could consistently control the LANG variable, I would be happy. I think
this was the problem the rejected patch was addressing. The submitter had
tried using export and the results were not consistent. If "export
LANG=en_US.UTF-8" worked as expected then there would be no need for the patch.
I'd also be happy if I could somehow unconditionally enable unicode support
perhaps via a config option or a command line parameter.
The only way I've found to get consistent unicode support is to use a ulang=xx
boot parameter for the language to be used and always add a lang=en_US.UTF-8
boot parameter. This workaround is fragile, confusing, and cumbersome.
It is possible the immutability is caused by the bootloaders but I ran into the
same problem with two different bootloaders. It would be great if busybox
could work around it somehow.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list