分页: 1 / 1

tcl PK perl PK ruby PK python

发表于 : 2009-12-03 1:14
millenniumdark
(;是我的shell提示符)

tcl

代码: 全选

; tclsh
% string length I  
1
% string length 我
1
% exit
perl5

代码: 全选

; perl -de 42

Loading DB routines from perl5db.pl version 1.31
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   42
  DB<1> print length 'I'
1
  DB<2> print length '我'
3
  DB<3> q
ruby1.8

代码: 全选

; irb
irb(main):001:0> 'I'.length
=> 1
irb(main):002:0> '我'.length
=> 3
irb(main):003:0> quit

代码: 全选

; python2
Python 2.6.4 (r264:75706, Nov 24 2009, 21:34:34) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> len('I')
1
>>> len('我')
3
>>> len(u'我')
3
>>> len(u'我'.encode('utf8'))
6
tcl裡,中文作變量名也O.K.

代码: 全选

% set 杯具 悲劇
悲劇
% puts $杯具
悲劇
在1999年發布的tcl就全面支持unicode了。當然,現在python3和ruby1.9也靠譜了。

Re: tcl PK perl PK ruby PK python

发表于 : 2009-12-03 2:55
peachcolor
:em20

Re: tcl PK perl PK ruby PK python

发表于 : 2009-12-03 9:10
eexpress
我不明真相了 lol

Re: tcl PK perl PK ruby PK python

发表于 : 2009-12-03 9:40
pityonline
四者是何关系?希望楼主普及一下哦……

Re: tcl PK perl PK ruby PK python

发表于 : 2010-06-05 16:59
millenniumdark
一楼的irb是ruby 1.8。

其实ruby 1.9里面,在ruby文件中指定编码utf-8,就O.K.了。

代码: 全选

# -*- coding: utf-8 -*-
ruby 1.8 里面也可以设置全局变量 $KCODE ,然后用jcode模块:

代码: 全选

irb(main):004:0> $KCODE = 'u'
=> "u"
irb(main):006:0> '我'.jlength
=> 1

Re: tcl PK perl PK ruby PK python

发表于 : 2010-06-06 13:54
UserLogin
tcl/tk 编gui比较多吧
现在高校已经用python启蒙了,java走下陂路了
另两个不会

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-05 15:33
millenniumdark
python3也O.K.了。

代码: 全选

Python 3.1.2 
>>> len('I')
1
>>> len('我')
1

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-06 12:57
pityonline
都是神话啊……

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-06 13:46
BigSnake.NET
In [15]: len('他喵的GFW'.decode('UTF-8'))
Out[15]: 6

In [16]: len('他喵的GFW')
Out[16]: 12
PS: 囗囗囗 == Game For Windows

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-06 22:33
anticlockwise
这是在干术磨??不明真相的路过~~

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-06 22:34
anticlockwise
关键是这个帖的POINT在哪?

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-07 15:58
millenniumdark
anticlockwise 写了:关键是这个帖的POINT在哪?
就是PK unicode的支持情況,特別是不是所有的string都是unicode string。

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-07 16:13
ChloeRei
其实ruby1995年发布的

Re: tcl PK perl PK ruby PK python

发表于 : 2010-08-11 18:07
anticlockwise
millenniumdark 写了:
anticlockwise 写了:关键是这个帖的POINT在哪?
就是PK unicode的支持情況,特別是不是所有的string都是unicode string。
哦~~那python2肯定不行啊~python3开始学JAVA了,所有都是UNICODE