Why does echo command in a csh script display multi-byte character string incorrectly?
Issue
- The following csh scripts (script1.sh, script2.sh) are expected to work in exactly the same way.
script1.sh (encoding:UTF8)
+------------------------------------------------------------------+
1 |#!/bin/csh -f |
2 |################################################################ |
3 |################################################################ |
4 |################################################################ |
... <repeat>
60 |################################################################ |
61 |################################################################ |
62 |setenv LANG ja_JP.eucjp |
63 |################################################################ |
64 |setenv LANG ja_JP.utf8 |
65 |echo <multi-byte character string> |
+------------------------------------------------------------------+
script2.sh (encoding:UTF8)
+------------------------------------------------------------------+
1 |#!/bin/csh -f |
2 |################################################################ |
3 |################################################################ |
4 |################################################################ |
... <repeat>
60 |################################################################ |
61 |################################################################ |
62 |setenv LANG ja_JP.eucjp |
63 |################################################################ |
64 |################################################################ |
65 |################################################################ |
66 |################################################################ |
67 |################################################################ |
68 |################################################################ |
69 |setenv LANG ja_JP.utf8 |
70 |echo <multi-byte character string> |
+------------------------------------------------------------------+
- However, echo command in script2.sh incorrectly displays multi-byte character string, while script1.sh doesn't have such a problem.
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.