This page is no longer maintained — Please continue to the home page at www.scala-lang.org

writing utf-8 characters in eclipse?

4 replies
Ittay Dror 2
Joined: 2010-05-05,
User offline. Last seen 42 years 45 weeks ago.
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

Lex
Joined: 2010-02-28,
User offline. Last seen 42 years 45 weeks ago.
Re: writing utf-8 characters in eclipse?
Does it work in console?

On Tue, Oct 4, 2011 at 12:31 PM, Ittay Dror <ittay.dror@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


Ittay Dror 2
Joined: 2010-05-05,
User offline. Last seen 42 years 45 weeks ago.
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


E. Labun
Joined: 2010-06-20,
User offline. Last seen 42 years 45 weeks ago.
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

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
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).

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland