bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash handles bytes instead of chars


From: ®om
Subject: bash handles bytes instead of chars
Date: Sun, 21 Sep 2008 10:41:03 +0200
User-agent: Thunderbird/3.0a2 (X11; 2008072418)

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='lin$ uname output: Linux rom-laptop 2.6.24-21-generic #1 SMP Mon Aug 25 17:32:09 UTC$
Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
        First of all, the result of locale :
$ locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

The char € utf8-encoded in hexa :
$ printf € | xxd -p
e282ac

//byte count
$ printf € | wc -c
3

//char count
$ printf € | wc -m
1

//prints the first char
$ printf € | cut -c1 | xxd -p | sed s/0a$//
e2
//should be e282ac

//prints each char
$ printf € | while read -n 1 v; do printf $v | xxd -p; done
e2
82
ac
//should be e282ac






reply via email to

[Prev in Thread] Current Thread [Next in Thread]