- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
writing utf-8 characters in eclipse?
Tue, 2011-10-04, 18:32
body
p { margin-bottom: 0cm; margin-top: 0pt; }
Hi,
I tried to write an operator method using utf characters (def … = null) and eclipse complains of an illegal character.
What am I doing wrong?
Ittay
Tue, 2011-10-04, 21:57
#2
Re: writing utf-8 characters in eclipse?
On Tuesday, October 4, 2011 7:34:27 PM UTC+2, Lex wrote:
Does it work in console?
I tried it in scalaconsole and there I got:
scala> def … = "hi"
<console>:1: error: illegal character
def … = "hi"
^
is '…' illegal somehow?
Ittay
On Tue, Oct 4, 2011 at 12:31 PM, Ittay Dror <ittay...@gmail.com> wrote:Hi,
I tried to write an operator method using utf characters (def … = null) and eclipse complains of an illegal character.
What am I doing wrong?
Ittay
Wed, 2011-10-05, 07:47
#3
Re: writing utf-8 characters in eclipse?
On 2011-10-04 22:56, Ittay Dror wrote:
> I tried it in scalaconsole and there I got:
> scala> def … = "hi"
> :1: error: illegal character
> def … = "hi"
> ^
>
> is '…' illegal somehow?
Hi Ittay,
I guess, the unicode periods are disallowed as identifier chars due to SLS (see "Chapter A" >
opchar) to avoid misleading code. Remember that (normal) dots aren't valid identifier chars.
Regarding your first question. I think it would help if you could attach the original file.
--
Eugen
PS: "SLS" = The Scala Language Specification
Wed, 2011-10-05, 11:37
#4
Re: writing utf-8 characters in eclipse?
On 05/10/2011 08:45, Eugen Labun wrote:
>> is '…' illegal somehow?
Yes. It is a Po (Punctuation, Other) symbol (\u2026).
If I read correctly the specification, you can use in identifiers:
- letters (Ll, Lu, Lt, Lo, Nl and $ & _)
- digits
- operator characters (lot of Ascii chars, Sm and So)
Po or other punctuation categories are not mentioned, so I suppose they are excluded.
⇐ and ⇒, for example, are Sm (symbol, math).
On Tue, Oct 4, 2011 at 12:31 PM, Ittay Dror <ittay.dror@gmail.com> wrote: