File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Unicode, escape seq Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Unicode, escape seq" Watch "Unicode, escape seq" New topic
Author

Unicode, escape seq

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707


Why \\u "double escape character" invalid?
I miss this concern with regex where we require "\\d" instead of "\d", we need two "\\" before d.
Please guide me!

Thanks and Regards,
cmbhatt


cmbhatt
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
This is the grammar for a Unicode escape from the Java Language Specification.

UnicodeEscape:
\ UnicodeMarker HexDigit HexDigit HexDigit HexDigit

UnicodeMarker:
the letter you - this site won't let you put the letter by itself
UnicodeMarker u


So you don't want to start with two backslashes because that will mean the second backslash should be interpreted as just the backslash and not as part of the Unicode escape.

Also this grammar implies that you can repeated the Unicode marker.

That is, each of these seperately will compile.

,

and so on.
[ April 03, 2007: Message edited by: Keith Lynn ]
Antonio Trapero
Greenhorn

Joined: Mar 24, 2007
Posts: 11
And boys, dont forget,
big farms need red tractors
\b \f \n \r \t
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Thanks Keith and Antonio!


Thanks and Regards,
cmbhatt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode, escape seq
 
Similar Threads
Problem reading Unicode Characters of a Web Page
short circuit operators
Strange Enum
Boxing, == and equals
Regarding wrappers