LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1180|回复: 13

问题 多多: 乱码 /自动补全/

[复制链接]
发表于 2007-3-23 18:29:14 | 显示全部楼层 |阅读模式
乱码:
我 原来的home 分区在新装gentoo的 时候直接挂到了 /下
但是 进入gnome后,home下面的中文文件都是乱码,原来/home 都是 utf8编码使用的

我已经安装了中文字体

自动补全:

启用sudo 后,没有自动补全功能了,我把原来home下的.bashrc 删除了,用了 /etc/bashrc
作为 .bashrc

还有就是ls的结果,目录和文件都是没有颜色的


输入法启动问题
:如何进入桌面 自动启动舒服法

echo "scim -d " > .xinitrc 不管用啊

gdm

如何让gdm自动启动

rc-update add gdm default 说没有gdm文件


.bashrc
  1. # /etc/bash/bashrc
  2. #
  3. # This file is sourced by all *interactive* bash shells on startup,
  4. # including some apparently interactive shells such as scp and rcp
  5. # that can't tolerate any output.  So make sure this doesn't display
  6. # anything or bad things will happen !


  7. # Test for an interactive shell.  There is no need to set anything
  8. # past this point for scp and rcp, and it's important to refrain from
  9. # outputting anything in those cases.
  10. if [[ $- != *i* ]] ; then
  11.         # Shell is non-interactive.  Be done now!
  12.         return
  13. fi

  14. # Bash won't get SIGWINCH if another process is in the foreground.
  15. # Enable checkwinsize so that bash will check the terminal size when
  16. # it regains control.  #65623
  17. # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
  18. shopt -s checkwinsize

  19. # Set colorful PS1 only on colorful terminals.
  20. # dircolors --print-database uses its own built-in database
  21. # instead of using /etc/DIR_COLORS.  Try to use the external file
  22. # first to take advantage of user additions.
  23. use_color=false
  24. safe_term=${TERM//[^[:alnum:]]/.}       # sanitize TERM

  25. if [[ -f /etc/DIR_COLORS ]] ; then
  26.         grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true
  27. elif type -p dircolors >/dev/null ; then
  28.         if dircolors --print-database | grep -q "^TERM ${safe_term}" ; then
  29.                 use_color=true
  30.         fi
  31. fi

  32. if ${use_color} ; then
  33.         if [[ ${EUID} == 0 ]] ; then
  34.                 PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
  35.         else
  36.                 PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  37.         fi
  38. else
  39.         if [[ ${EUID} == 0 ]] ; then
  40.                 # show root@ when we don't have colors
  41.                 PS1='\u@\h \W \$ '
  42.         else
  43.                 PS1='\u@\h \w \$ '
  44.         fi
  45. fi

  46. # Try to keep environment pollution down, EPA loves us.
  47. unset use_color safe_term
复制代码


贴上 fstab
  1. # <fs>                  <mountpoint>    <type>          <opts>  <dump/pass>

  2. # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
  3. /dev/hda3               /boot           ext3            defaults1 2
  4. /dev/hda8               /               ext3            defaults0 1
  5. /dev/hda7               none            swap            sw      0 0
  6. /dev/cdroms/cdrom0      /mnt/cdrom      iso9660         auto,user        0 0
  7. /dev/hda4               /home           ext3            defaults        0 0
  8. #/dev/fd0               /mnt/floppy     auto            noauto  0 0

  9. # NOTE: The next line is critical for boot!
  10. none                    /proc           proc            defaults0 0

  11. # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
  12. # POSIX shared memory (shm_open, shm_unlink).
  13. # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
  14. #  use almost no memory if not populated with files)
  15. none                    /dev/shm        tmpfs           defaults0 0
  16. none                    /proc/bus/usb   usbfs           defaults
复制代码
 楼主| 发表于 2007-3-23 18:32:38 | 显示全部楼层
joey@gentoo ~ $ cat .bash_profile
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs
#umask 022

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
    PATH=~/bin:"${PATH}"
fi
回复 支持 反对

使用道具 举报

发表于 2007-3-23 19:12:23 | 显示全部楼层
1.
rc-update add xdm default
不是 gdm
2.
你应该先 emerge -uvDN world,2006.1的亮色是有问题,所以应该先升级。
3.
输入法:
touch /etc/X11/xinit/xinitrc.d/02-scim
chmod a+x /etc/X11/xinit/xinitrc.d/02-scim
02-scim内容为:
  1. export XMODIFFIERS="@im=SCIM"
  2. export GTK_IM_MODULE="scim"
  3. export QT_IM_MODULE="scim"
  4. scim -d
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-23 19:49:05 | 显示全部楼层
那 home 分区乱码呢

我挂载了win的分区,没有乱码啊

home 倒是乱码

奇怪了
回复 支持 反对

使用道具 举报

发表于 2007-3-23 21:20:16 | 显示全部楼层
Post by shitbaby
那 home 分区乱码呢

我挂载了win的分区,没有乱码啊

home 倒是乱码

奇怪了


in cmd line, type locale

check which locale you are using.
回复 支持 反对

使用道具 举报

发表于 2007-3-24 12:30:29 | 显示全部楼层
对,估计是没有设置 locale ,默认的 locale 是 C 或 POSIX

/etc/locale.gen:
  1. zh_CN.UTF-8 zh_CN UTF-8
  2. zh_CN .....
复制代码
locale-gen
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-25 07:49:00 | 显示全部楼层
  1. joey@gentoo ~ $ locale
  2. LANG=zh_CN.UTF-8
  3. LC_CTYPE="zh_CN.UTF-8"
  4. LC_NUMERIC="zh_CN.UTF-8"
  5. LC_TIME="zh_CN.UTF-8"
  6. LC_COLLATE="zh_CN.UTF-8"
  7. LC_MONETARY="zh_CN.UTF-8"
  8. LC_MESSAGES="zh_CN.UTF-8"
  9. LC_PAPER="zh_CN.UTF-8"
  10. LC_NAME="zh_CN.UTF-8"
  11. LC_ADDRESS="zh_CN.UTF-8"
  12. LC_TELEPHONE="zh_CN.UTF-8"
  13. LC_MEASUREMENT="zh_CN.UTF-8"
  14. LC_IDENTIFICATION="zh_CN.UTF-8"
  15. LC_ALL=
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-27 08:17:49 | 显示全部楼层
我原来home是resisfs 格式的,把分区的内容曾经备份到 win分区

后来我安装gentoo的时候,把分区格式化成 ext3 了,再把备份的内容拷贝回home分区

经历这样一个过程 有关系不?
回复 支持 反对

使用道具 举报

发表于 2007-3-27 12:51:02 | 显示全部楼层
晕哦,这样当然有问题了啊。
Win分区的 codepage是 936,编码应该是 GB2312 的,cp时如果没有用和原来backup时相同的iocharset,就会乱码。
你可以通过iconv来测试下你现在的中文文件名的编码,再用convmv来转换为utf8.或直接用convmv转换,emerge convmv
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-28 14:30:12 | 显示全部楼层
joey@gentoo ~ $ iconv -f GB2312 -t UTF-8   \?\?\?\?.mp3 >受了点伤.mp3
iconv: 未知 0 处的非法输入序列

选择乱码的输入文件,会不会有问题

如何使用啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表