| Author |
illegal unicode escape
|
Brajmohan Jangir
Greenhorn
Joined: Apr 17, 2012
Posts: 3
|
|
public class Hello{
//Commented character '\uFF'
}
Compiler shows me "illegal unicode escape".
Please can you explain me why compiler looks inside commented code?
I am working on Windows and using jdk 1.6.
Thanks in Advance.
|
 |
Pondurai Singh
Ranch Hand
Joined: Jun 27, 2011
Posts: 32
|
|
|
You could work around it by inserting a space char after the backslash
|
Software Developer, Oracle Java Certification Training Labs at EPractize Labs
OCPJP 7 | OCAJP 7
|
 |
Brajmohan Jangir
Greenhorn
Joined: Apr 17, 2012
Posts: 3
|
|
Thanks a lot for quick response.
I really appreciate your answer.
But I am looking for the cause of this compilation failure.
Why this comment fails the compilation?
|
 |
Pondurai Singh
Ranch Hand
Joined: Jun 27, 2011
Posts: 32
|
|
Unicode Escapes
A compiler for the Java programming language ("Java compiler") first recognizes Unicode escapes in its input, translating the ASCII characters \u followed by four hexadecimal digits to the UTF-16 code of the indicated hexadecimal value, and passing all other characters unchanged. Representing supplementary characters requires two consecutive Unicode escapes. This translation step results in a sequence of Unicode input characters.
In addition to the processing implied by the grammar, for each raw input character that is a backslash \, input processing must consider how many other \ characters contiguously precede it, separating it from a non-\ character or the start of the input stream. If this number is even, then the \ is eligible to begin a Unicode escape; if the number is odd, then the \ is not eligible to begin a Unicode escape.
|
 |
Brajmohan Jangir
Greenhorn
Joined: Apr 17, 2012
Posts: 3
|
|
I got the reason.
It means compiler tries to translate the ASCII characters \u followed by hexadecimal digits to UTF-16 code and if compiler founds any illegal Unicode escape then it fails.
Thank you very much...
|
 |
 |
|
|
subject: illegal unicode escape
|
|
|