Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7827
| Date | 2011-09-11 17:48 -0400 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: ascii char 26 |
| References | <16f8836c-27b9-483b-a71f-61d7d6cfd188@i2g2000yqm.googlegroups.com> |
| Message-ID | <4e6d2c91$0$309$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 9/11/2011 5:33 PM, bob wrote:
> Anyone know why ASCII char 26 is used in place of a hyphen in UTF-8?
>
> I had to write this function to deal with this:
>
> public static String convertToAscii(String html) {
> html = html.replaceAll("\u2019", "'");
> html = html.replaceAll("\u201D", "\"");
> html = html.replaceAll("\u201C", "\"");
>
> byte[] b = null;
> try {
> b = html.getBytes("US-ASCII");
> } catch (UnsupportedEncodingException e) {
> e.printStackTrace();
> }
>
> // hyphen replace
> for (int ctr = 0; ctr< b.length; ctr++)
> if (b[ctr] == 26)
> b[ctr] = 45;
>
> html = new String(b);
> return html;
> }
ASCII code 26 is not in general replaced with hyphen.
If you are asking why some code may do it, then in
some contexts (usually on Windows platform) ASCII code
26 indicates EOF.
Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
ascii char 26 bob <bob@coolgroups.com> - 2011-09-11 14:33 -0700
Re: ascii char 26 Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 17:48 -0400
Re: ascii char 26 Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-11 16:52 -0500
Re: ascii char 26 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-11 18:28 -0400
Re: ascii char 26 bob <bob@coolgroups.com> - 2011-09-11 19:12 -0700
Re: ascii char 26 Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-11 21:25 -0500
Re: ascii char 26 bob <bob@coolgroups.com> - 2011-09-12 01:30 -0700
Re: ascii char 26 Roedy Green <see_website@mindprod.com.invalid> - 2011-09-11 15:25 -0700
Re: ascii char 26 Bent C Dalager <bcd@pvv.ntnu.no> - 2011-09-11 23:18 +0000
Re: ascii char 26 Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-09-11 18:37 -0500
Re: ascii char 26 Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-11 16:53 -0700
Re: ascii char 26 Roedy Green <see_website@mindprod.com.invalid> - 2011-09-14 11:55 -0700
csiph-web