linuxÖÐÏÔʾÖÐÎÄÂÒÂëµÄÎÊÌâ
ÓÉÓÚÔÚwindowsÏÂĬÈÏÊÇgb±àÂ룬¶øÎÒµÄvimĬÈÏÊÇutf-8£¨geditĬÈÏÒ²ÊÇutf-8£©£¬ËùÒÔ´ò¿ª»á³ÉÂÒÂë¡£ÐÞ¸ÄÁËÒ»ÏÂÅäÖÃÎļþ£¬
ʹvi
Ö§³Ögb±àÂë¾ÍºÃÁË¡£
$vi
~/.vimrc
let
&termencoding=&encoding
set fileencodings=utf-8,gbk
$:wq
ÔÙ
´Î´ò¿ªvi
£¬ÏÔʾ¾ÍÕý³£ÁË¡£
Èç¹ûÄãÐèÒªÔÚlinuxÏÂÃæÓõ½windowsϵÄÎļþ£¬¿½±´ÉÏÈ¥ºó¾³£·¢ÏÖÖÐÎÄÏÔʾÂÒÂë¡£¡£ÔÒòÊÇWindowsÖÐĬÈϵÄÎļþ¸ñʽÊÇ
GBK(gb2312)£¬¶øLinuxÒ»°ã¶¼ÊÇUTF-8¡£±È½Ï·±ËöµÄ·½·¨ÊÇÔÚwindowsÏÂÓóÌÐò°ÑÄÚÈÝת»»Îªutf-8±àÂë¸ñʽµÄ£¬µ«ÊÇÏ൱Âé·³£¬
¶øÇÒÓöµ½Ò»¸öÎļþתһ»Ø¡£ÏÂÃæ½éÉÜһϣ¬ÔÚLinuxÖÐÈçºÎÒ»ÀÍÓÀÒݵĽâ¾öÕâ¸öÎÊÌ⣬²é¿´ÎļþµÄ±àÂë¼°ÈçºÎ½øÐжÔÎļþ½øÐбàÂëת»»¡£
²é¿´Îļþ±àÂë
ÔÚLinuxÖв鿴Îļþ±àÂë¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖ·½Ê½£º
1.ÔÚ
Vim
ÖпÉÒÔÖ±½Ó²é¿´Îļþ±àÂë
:set fileencoding
¼´¿ÉÏÔʾÎļþ±àÂë¸ñʽ¡£
Îļþ±àÂëת»»
1.Èç¹ûÄãÖ»ÊÇÏë²é¿´ÆäËü±àÂë¸ñʽµÄÎļþ»òÕßÏë½â¾öÓÃVim²é¿´ÎļþÂÒÂëµÄÎÊÌ⣬ÄÇôÄã¿ÉÒÔÔÚ
~/.vimrc£¨ÔÚ/etcĿ¼ÏÂÃ棩 ÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
ÆäÖÐencodingÊÇvimµÄĬÈÏÏÔʾ±àÂë¸ñʽ£¬fileencodingsÊÇvim´ò¿ªÎļþʱ¼ì²âµÄ±àÂë¸ñʽ£¬´æÔÚÕâÖÖÀàÐ͵ıàÂ뼴ת»»Îªutf-8
±àÂë¡£
ÕâÑù£¬¾Í¿ÉÒÔÈÃvim×Ô¶¯Ê¶±ðÎļþ±àÂ루¿ÉÒÔ×Ô¶¯Ê¶±ðUTF-8»òÕßGBK±àÂëµÄÎļþ£©£¬Æäʵ¾ÍÊÇÒÀÕÕfileencodingsÌṩµÄ±àÂëÁÐ±í³¢ÊÔ£¬Èç
¹ûûÓÐÕÒµ½ºÏÊʵıàÂ룬¾ÍÓÃlatin-1(ASCII)±àÂë´ò¿ª¡£
2.ÔÚVimÖÐÖ±½Ó½øÐÐת»»Îļþ±àÂë,±ÈÈ罫һ¸öÎļþת»»³Éutf-8¸ñʽ£¨²»ºÃÓã©
:set fileencoding=utf-8
3.iconv ת»»£¬iconvµÄÃüÁî¸ñʽÈçÏ£º£¨Î´Óã©
iconv -f encoding -t encoding inputfile
±ÈÈ罫һ¸öUTF-8 ±àÂëµÄÎļþת»»³ÉGBK±àÂë
iconv -f GBK -t UTF-8 file1 -o file2
ÎļþÃû±àÂëת»»:
´Ó
Linux
Íù
windows¿½±´Îļþ»òÕß´ÓwindowsÍùLinux¿½±´Îļþ£¬ÓÐʱ»á³öÏÖÖÐÎÄÎļþÃûÂÒÂëµÄÇé¿ö£¬³öÏÖÕâÖÖÎÊÌâµÄÔÒòÊÇÒòΪ£¬windowsµÄÎļþÃû
ÖÐÎıàÂëĬÈÏΪGBK,¶øLinuxÖÐĬÈÏÎļþÃû±àÂëΪUTF8,ÓÉÓÚ±àÂë²»Ò»Ö£¬ËùÒÔµ¼ÖÂÁËÎļþÃûÂÒÂëµÄÎÊÌ⣬½â¾öÕâ¸öÎÊÌâÐèÒª¶ÔÎļþÃû½øÐÐתÂë¡£
ÔÚLinuxÖÐרÃÅÌṩÁËÒ»ÖÖ¹¤¾ßconvmv½øÐÐÎļþÃû±àÂëµÄת»»£¬¿ÉÒÔ½«ÎļþÃû´ÓGBKת»»³ÉUTF-8±àÂë,»òÕß´ÓUTF-8ת»»µ½GBK¡£
Ê×ÏÈ¿´Ò»ÏÂÄãµÄϵͳÉÏÊÇ·ñ°²×°ÁËconvmv,Èç¹ûû°²×°µÄ»°ÓÃÔÚ
http://www.j3e.de/linux/convmv/co
Ïà¹ØÎĵµ£º
½ñÌ죬°ÑwindowsÏµĹ¤³Ìµ¼Èëµ½ÁËLinuxÏÂeclipseÖУ¬ÓÉÓÚÒÔÇ°µÄ¹¤³Ì´úÂ룬¶¼ÊÇGBK±àÂëµÄ£¬¶øUbuntuĬÈÏÊDz»Ö§³ÖGBK±àÂëµÄ¡£ËùÒÔ£¬Ê×ÏÈÎÒÃÇÒªÏÈÈÃUbuntuÖ§³ÖGBK£¬·½·¨ÈçÏ£º
1.
ÐÞ¸Ä/var/lib/locales /supported.d/localÎļþ,ÔÚÎļþÖÐÌí¼Ó
z ......
ÎĵµÑ¡Ïî
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
¼¶±ð£º ³õ¼¶
Ö£ÑåÐË (mlinux@163.com), ¹ú·À¿Æ´ó¹¥¶Á²©Ê¿Ñ§Î»
2003 Äê 5 ÔÂ 01 ÈÕ
¹²ÏíÄÚ´æ¿ÉÒÔ˵ÊÇ×îÓÐÓõĽø³Ì¼äͨÐÅ·½Ê½£¬Ò²ÊÇ×î¿ìµÄIPCÐÎʽ¡£Á½¸ö²»Í¬½ø³ÌA¡¢B¹²ÏíÄÚ´æµÄÒâ˼ÊÇ£¬Í¬Ò»¿éÎïÀíÄÚ´æ±»Ó³Éäµ½½ø³ÌA¡¢B¸÷×ԵĽø³ÌµØÖ·¿Õ¼ä¡£½ø³ÌA¿ÉÒÔ¼´Ê±¿´µ ......
ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ïß³Ì³Ø ......
µÚ1ÕÂ×Ö·û²âÊÔº¯Êýisalnum(²âÊÔ×Ö·ûÊÇ·ñΪӢÎÄ×Öĸ»òÊý×Ö)isalpha(²âÊÔ×Ö·ûÊÇ·ñΪӢÎÄ×Öĸ)isascii(²âÊÔ×Ö·ûÊÇ·ñΪASCIIÂë×Ö·û)isblank(²âÊÔ×Ö·ûÊÇ·ñΪ¿Õ¸ñ×Ö·û)iscntrl(²âÊÔ×Ö·ûÊÇ·ñΪASCIIÂëµÄ¿ØÖÆ×Ö·û)isdigit(²âÊÔ×Ö·ûÊÇ·ñΪ°¢À²®Êý×Ö)isgraph(²âÊÔ×Ö·ûÊÇ·ñΪ¿É´òÓ¡×Ö·û)islower(²âÊÔ×Ö·ûÊÇ·ñΪСдӢÎÄ×Öĸ)isprint(² ......
ÔÎijö´¦£ºhttp://blog.mcuol.com/User/hzami/Article/8116_1.htm
ÓÉÓںܶàÈË×ÜÎÊÕâ¸öÎÊÌ⣬ËùÒÔÕâÀï×öÒ»¸ö×ܽáÎĵµ¹©´ó¼Ò²Î¿¼¡£ÕâÀï±ØÐëÏÈ˵Ã÷£¬ÒÔϵIJ½Ö趼ÊÇÕë¶ÔLinuxϵͳµÄ£¬²¢²»ÃæÏòWinCE¡£Ò²ÐíÄã
»á×¢Òâµ½£¬ÏÖÔÚ×öǶÈëʽµÄÈËÖУ¬×ölinuxÑо¿µÄÈËÔ¶±È×öWinCEµÄÈ˶࣬ºÜ¶à²ú¼ÒÌṩµÄ×ÊÁÏÒ²ÊÇÒÔlinuxΪÖ÷¡£ÎÒÒ»Ö±ºÜÄÑ ......