Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36974
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2017-07-21 06:07 -0700 |
| References | <e5731f8f-201f-43fb-99f4-46caac570c41@googlegroups.com> <okr94s$e1e$1@dont-email.me> |
| Message-ID | <72876194-7050-42e7-83db-9c4f7ec495e8@googlegroups.com> (permalink) |
| Subject | Re: Anyone know anything about string encodings? |
| From | Eric Douglas <e.d.programmer@gmail.com> |
On Thursday, July 20, 2017 at 6:04:12 PM UTC-4, Joshua Cranmer đ§ wrote:
>
> 1. Use the charset field within the document (if present)
> 2. Else, use the Content-Type header (if present)
> 3. Otherwise, play the game of charset roulette.
> UTF-8-if-valid-else-Windows-1252 is usually the easiest way to win this
> game.
>
Well, I see Google put it in the parameters. Is this good?
String charset = null;
final HttpEntity ent = httpResp.getEntity();
for (Header hdr : httpResp.getAllHeaders()) {
for (HeaderElement he : hdr.getElements()) {
for (NameValuePair nvp : he.getParameters()) {
if (nvp.getName().equals("charset")) {
charset = nvp.getValue();
break;
}
}
if (charset != null) break;
}
if (charset != null) break;
}
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Anyone know anything about string encodings? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-20 13:22 -0700
Re: Anyone know anything about string encodings? Joshua Cranmer đ§ <Pidgeot18@verizon.invalid> - 2017-07-20 17:03 -0500
Re: Anyone know anything about string encodings? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-21 06:07 -0700
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-21 19:47 -0400
Re: Anyone know anything about string encodings? Joshua Cranmer đ§ <Pidgeot18@verizon.invalid> - 2017-07-22 12:20 -0500
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-22 16:40 -0400
Re: Anyone know anything about string encodings? Joshua Cranmer đ§ <Pidgeot18@verizon.invalid> - 2017-07-24 09:27 -0500
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-24 10:54 -0400
Re: Anyone know anything about string encodings? Joshua Cranmer đ§ <Pidgeot18@verizon.invalid> - 2017-07-24 16:04 -0500
Re: Anyone know anything about string encodings? lewbloch@gmail.com - 2017-07-24 17:40 -0700
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-25 09:16 -0400
Re: Anyone know anything about string encodings? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2017-07-25 11:50 +0300
Re: Anyone know anything about string encodings? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2017-07-25 11:51 +0300
Re: Anyone know anything about string encodings? Joshua Cranmer đ§ <Pidgeot18@verizon.invalid> - 2017-07-25 09:39 -0500
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-25 14:34 -0400
Re: Anyone know anything about string encodings? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2017-07-25 13:07 +0200
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-25 09:12 -0400
Re: Anyone know anything about string encodings? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2017-07-25 18:05 +0300
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-25 14:31 -0400
Re: Anyone know anything about string encodings? lewbloch@gmail.com - 2017-07-26 11:23 -0700
Re: Anyone know anything about string encodings? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-20 18:09 -0400
Re: Anyone know anything about string encodings? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-21 06:09 -0700
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-21 19:46 -0400
Re: Anyone know anything about string encodings? Arne VajhĂžj <arne@vajhoej.dk> - 2017-07-20 20:18 -0400
csiph-web