Although I'm not exactly sure what's going on, I think this is likely an
encoding issue and perhaps also an issue with how you're running that code.
Check how you're running this code, is it in a file or are you entering it in a
terminal?
In my experimentation, for both 1.1 and 1.2, if I run this code in the terminal
I'll get 27 as the answer. Why, I'm not sure, but it may have to do with the
fact that my terminal is UTF-8.
However, if this is loaded by clojure from a file, it will return 9 for both
1.1 and 1.2, even though the file is stored as UTF-8 as well.
The story gets weirder though, because although Java strings are UTF-16
(*ugh*), if I save the source to a UTF-16 encoded file, clojure will throw an
exception and won't even be able to read it:
Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: ?? in this context (test-utf16.clj:0)
So, this is weird and I'd love it if someone could explain what's going on, but
I don't think this has to do with the clojure version (at least in my testing).
- Greg
On Jul 1, 2010, at 12:59 PM, Stuart Halloway wrote:
> I see 9 on 1.2 as well. The call to .length is a Java interop form, so it is
> very difficult to imagine how this might change.
>
> Stu
>
>> With 1.2-master-SNAPSHOT:
>>
>> (def t "車馬象士將士象馬車")
>> (count t) ; => 27
>> (.length t) ; => 27
>>
>> With 1.1, the result is 9.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> Note that posts from new members are moderated - please be patient with your
>> first post.
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en