tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Korthof ...@apache.org>
Subject Re: Tomcat bug
Date Sat, 03 Jun 2000 23:47:14 GMT
On Sat, 3 Jun 2000, Ed Korthof wrote:

> This is not a valid Java statement:
> 
> 	char c = '\u000d';
> 
> because the '\u000d' is not a valid character constant.

The Java Language Spec is very helpful at times like this.  Here's what it
has to say about this particular value:

	Because Unicode escapes are processed very early, it is not
	correct to write '\u000a' for a character literal whose value is
	linefeed (LF); the Unicode escape \u000a is transformed into an
        actual linefeed in translation step 1 (3.3) and the linefeed
        becomes a LineTerminator in step 2 (3.4), and so the character
        literal is not valid in step 3. Instead, one should use the escape
        sequence '\n' (3.10.6). Similarly, it is not correct to write
        '\u000d' for a character literal whose value is carriage return
        (CR). Instead, use '\r'.

This is out of http://java.sun.com/docs/books/jls/html/3.doc.html#100960
... IMO, it is kinda lame (why special case these two characters?), but
that's how the spec is written.

good luck --

Ed


Mime
View raw message