How to switch charset in terminal?
I have to execute with a sqlplus sql scripts written using CP1251 charset. For this purpose i assigned "RUSSIAN_RUSSIA.CL8MSWIN1251" to NLS_LANG environment variable. At the same time a terminal i execute scripts on is configured to use UTF-8 charset by default. Problem is that the sqlplus outputs messages in CP1251 and they are unreadable on the terminal. I tried to assign ru_RU.CP1251 to LANG environment variable. It didn't help. Is there a short way to switch charset in one virtual terminal and then switch it back?
|
|
Quote:
Code:
$ echo $LANG |
I noticed you are using some mysql query and as it happened to me that some CP-8859-2 characters in database were not displayed I had to use:
Code:
mysql charset connection good luck |
if you are using Bash, then set
Code:
export LANG="ru_RU.CP1251" LC_ALL="ru_RU.CP1251" You can always run a single command using Code:
command | iconv -f cp1251//TRANSLIT If you have a curses program -- a text-based interactive program -- which uses some other character set than your terminal is set to, you can use luit : Code:
luit -encoding cp1251 -- command I like to keep my terminal in UTF-8, but connect to an ancient machine which uses ISO-8859-15. A simple luit -encoding iso-8859-15 ssh ancient.machine works perfectly. If interrupted/killed, luit may forget to restore the terminal settings, but that is harmless: just run stty sane or tput reset to fix. The former will not clear the terminal, but may not work; the latter will clear your scrollback. Both are completely safe to run. |
Quote:
Quote:
Quote:
|
I've tried to run less with luit for example:
Code:
luit -encoding cp1251 less test.txt Code:
j`j`ÿ-rn jhphkkhweqj`ÿ m`dohq| Code:
$ locale Code:
$ locale -a | egrep '.*ru.*1251.*' |
All times are GMT -5. The time now is 04:46 AM. |