Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: replace extended characters Date: Fri, 11 Feb 2011 16:55:26 -0800 Organization: Canadian Mind Products Lines: 22 Message-ID: References: <15bd3363-c781-487b-98d5-2243eff7cc8f@24g2000yqa.googlegroups.com> Reply-To: Roedy Green NNTP-Posting-Host: RCd/Ul4tyxGUBII8WGwa5g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: csiph.com comp.lang.java.programmer:26193 On Thu, 10 Feb 2011 19:18:36 -0500, Lew wrote, quoted or indirectly quoted someone who said : >If you are certain that the set of possible input characters is small, and >those you wish to substitute even smaller, you can use a lookup table. Use a >'Map' (will choke on supplementary code points) for >those, and only those, you wish to substitute. If the key is absent, pass the >source character through unchanged. If present, replace with the associated >value. If you are just handling 256 or 4906 possible chars, then an ordinary array will be both easy to code and very fast. The highest named entity is 9830 ♦ 0x2666 black diamond suit. There are 2^16 = 65536 possible 16-bit unicode chars. Which chars do you transform? -- Roedy Green Canadian Mind Products http://mindprod.com Refactor early. If you procrastinate, you will have even more code to adjust based on the faulty design. .