Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Unicode escapes and String literals? Date: Thu, 13 Dec 2012 14:00:54 -0800 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 13 Dec 2012 22:00:57 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="22751"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Jt31qDzY49OYMlXC6hUujs/RBMuKrU1Y=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Cancel-Lock: sha1:0178Ij8YajKoorqAVwYwdSgDA2I= Xref: csiph.com comp.lang.java.programmer:20302 On 12/13/2012 1:21 PM, David Lamb wrote: > > Cute. But presupposing that the OP isn't the idiot some people seem to > have assumed, I suspect he meant something more like > > String line = someBufferedFile.readline(); > ... change all \u escapes into unicode in "line" ... [1] Maybe. But your code above is obvious, imo. Either Knute had a brain fart and forgot about \\ to escape a slash, or he ran into some other problem. My point was that there's a very simple pre-compiler for Java. It translates all \u-escapes into characters before the compiler proper sees it. There's no difference to the Java compiler between "fed" and "\u0066\u0065\u0064". It literally can't tell the difference. That's an important distinction.