Hi All,
How do i represent � symbol in unix and how to retain � symbol in file.
Thanks in Advance
Hi All,
How do i represent � symbol in unix and how to retain � symbol in file.
Thanks in Advance
There is _always_ a way.
Longhand using builtins.
OSX 10.7.5, _bash_ terminal...
#!/bin/sh
echo "UK currency sign is � as in �100.25p." > /tmp/pound.txt
read pound < /tmp/pound.txt
length=$[ ( ${#pound} - 1 ) ]
newtext=""
for subscript in $( seq 0 $length )
do
if [ "${pound:$subscript:1}" == "�" ]
then
newtext="$newtext#"
else
newtext="$newtext${pound:$subscript:1}"
fi
done
echo ""
echo "File _pound_ unchanged..."
echo "$pound"
echo ""
echo "Variable _newtext_ showing # sign in its place..."
echo "$newtext"
echo ""
Result...
Last login: Thu Dec 12 07:43:53 on ttys000
AMIGA:barrywalker~> chmod 775 pound.sh
AMIGA:barrywalker~> ./pound.sh
File _pound_ unchanged...
UK currency sign is � as in �100.25p.
Variable _newtext_ showing # sign in its place...
UK currency sign is # as in #100.25p.
AMIGA:barrywalker~> _
Depending on your locale setting, it may be mapped to some character above 128. If using the utf8 char set / locale, it is the two byte char \302\243
or 0xc2 0xa3
or M-BM-#
(M = Meta). It depends on your keyboard driver/keyboard mapping if it is immediately available from your keyboard.
After loading data into text file through Datastage jobs, in Unix prompt I'm seeing pound symbol representation as £ whereas in Datastage when I view data I'm seeing value as � and � value is not seen in tool.
What is this representation of pound symbol called?
Thanks in Advance