Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: illegal line end in character literal in escaped unicode CARRIAGERETURN / NEW LINE

Reply
Thread Tools

Re: illegal line end in character literal in escaped unicode CARRIAGERETURN / NEW LINE

 
 
Lew
Guest
Posts: n/a
 
      05-15-2009
On May 15, 9:51*am, Christian <(E-Mail Removed)> wrote:
> Hi folks,
>
> I just stumbled replacing an escaped Unicode of CARRIAGE RETURN / NEW
> LINE and got a compiler-error "illegal line end in character literal"
> for
>
> switch (original)
> {
> * * * * case '\u000D' : return '\u0020';


use less wide indentation, please.

> * * * * case '\u000A' : return '\u0020';
>
> }
>
> To be honest: I don't have the slightest idea what the compiler is
> complaining about. The escape-sequence \u seems to be correct
> according to most of the sources I came across and the two-digited
> hexadecimal encoding cannot be wrong - so what's up here?


You ended the line after the keyword 'case' without giving it a
constant. Bear in mind that Unicode escape sequences are substituted
prior to parsing the source, so for example, your second 'case' is
exactly equivalent to:

case '
' : return ' ';

Do you see how that is not a legal Java syntax?

--
Lew

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: illegal line end in character literal in escaped unicode CARRIAGERETURN / NEW LINE Joshua Cranmer Java 0 05-15-2009 02:50 PM
Re: illegal line end in character literal in escaped unicode CARRIAGERETURN / NEW LINE Mark Space Java 0 05-15-2009 02:35 PM
Re: illegal line end in character literal in escaped unicode CARRIAGE RETURN / NEW LINE Andreas Leitgeb Java 0 05-15-2009 02:02 PM
xmlrpclib and carriagereturn (\r) Jonathan Ballet Python 5 03-18-2006 01:52 PM
Literal Escaped Octets Chason Hayes Python 11 02-08-2006 11:53 PM



Advertisments