languages with full unicode support
Mumia W.
mumia.w.18.spam+nospam.usenet at earthlink.net
Sun Jun 25 15:27:35 EDT 2006
Xah Lee wrote:
> Languages with Full Unicode Support
>
> As far as i know, Java and JavaScript are languages with full, complete
> unicode support. That is, they allow names to be defined using unicode.
> (the JavaScript engine used by FireFox support this)
>
> As far as i know, here's few other lang's status:
>
> C → No.
> Python → No.
> Perl → No.
Perl supports unicode in its core, and that include identifier names
using exotic characters.
> Haskell → Yes by the spec, but no on existing compilers.
Erm, isn't this an effective "No"?
> JavaScript → No in general. Firefox's engine do support it.
> Lisps → No.
> unix shells (bash) → No. (this probably applies to all unix shells)
> Java → Yes and probably beats all. However, there may be a bug in 1.5
> compiler.
>
> Also, there appears to be a bug with Java 1.5's unicode support. The
> following code compiles fine in 1.4, but under 1.5 the compiler
> complains about the name x1.str★.
>
> class 方 {
> String str北 =
> "北方有佳人,絕世而獨立。\n一顧傾人城,再顧傾人国。\n寧不知倾城与倾国。\n佳人難再得。";
> String str★="θπαβγλϕρκψ ≤≥≠≈⊂⊃⊆⊇∈
> ⅇⅈⅉ∞∆° ℵℜℂℝℚℙℤ ℓ∟∠∡ ∀∃ ∫∑∏
> ⊕⊗⊙⊚⊛∘∙ ★☆";
>
> }
>
> class UnicodeTest {
> public static void main(String[] arg) {
> 方 x1 = new 方();
> System.out.println( x1.str北 );
> System.out.println( x1.str★ );
> }
> }
>
> If you know a lang that does full unicode support, please let me know.
> Thanks.
>
> Xah
> xah at xahlee.org
> ∑ http://xahlee.org/
Perl is coming close to having full unicode support. '★' is not an
alphabetic or numeric character and has no place in an identifier. That
is why both Perl and Java reject it. Let's see what Perl can do:
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
package 方;
our $str北="北方有佳人,絕世而獨立。\n一顧傾人城,再顧傾人国。"
. "\n寧不知倾城与倾国。\n佳人難再得。";
our $strβ = "θπαβγλϕρκψ ≤≥≠≈⊂⊃⊆⊇∈
ⅇⅈⅉ∞∆° ℵℜℂℝℚℙℤ ℓ∟∠∡ ∀∃ ∫∑∏
⊕⊗⊙⊚⊛∘∙ ★☆";
sub new {
my $class = shift;
my $self = {
str北 => \$str北,
'strβ' , \$strβ,
};
bless ($self, $class);
}
sub str北 {
${ (shift)->{str北} };
}
sub strβ {
${ (shift)->{strβ} };
};
package Test方;
sub do {
binmode STDOUT, 'utf8';
my $obj方 = 方->new();
$\ = "\n";
print $obj方->str北();
print '----------------';
print $obj方->strβ();
}
Test方->do();
More information about the Python-list
mailing list