unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* I'm looking for a method of converting a string's character encoding
@ 2012-04-27 21:13 Sunjoong Lee
  2012-04-28  1:40 ` Sunjoong Lee
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Sunjoong Lee @ 2012-04-27 21:13 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

Hello,

I'm looking for a method of converting a string's character encoding from a
certain codeset to utf-8. I know the string of Guile uses utf-8 and (read
(open-bytevector-input-port (string->utf8 "hello"))) returns "hello" . But
what if the string "hello" be encoded not utf-8 and you want to get utf-8
converted string? What I want is like iconv.

Background;
#:decode-body? keyword of http-get seems not to work properly; I should
set #:decode-body? to false value and decode the contents body string
manually. If a web page's charset be utf-8, there be no problem. If not, a
problem occurs. decode-response-body of (web client) call decode-string
with web page's charset. But real charset of bytevector is iso-8859-1,
not web page's charset. If so, you should not let http-get
use decode-response-body.

After getting response-body with bytevector form, you should decode it with
"iso-8859-1" like decode-string's manner. Then you'll get web page's
contents body string; it's charset is what you see in response header.

Now, I need to convert this contents body string to utf-8 but I don't know
how. I think it would be with port i/o.

Thanks.

[-- Attachment #2: Type: text/html, Size: 1411 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-05-03 22:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 21:13 I'm looking for a method of converting a string's character encoding Sunjoong Lee
2012-04-28  1:40 ` Sunjoong Lee
2012-04-28 16:38 ` Sunjoong Lee
2012-04-28 17:33   ` Thien-Thi Nguyen
2012-04-28 18:29     ` Daniel Krueger
2012-04-28 19:54       ` Thien-Thi Nguyen
2012-04-28 20:55       ` Eli Zaretskii
2012-04-28 22:42         ` Sunjoong Lee
2012-04-29  0:25         ` Sunjoong Lee
2012-04-30 10:18         ` Daniel Krueger
2012-04-30 12:21           ` Eli Zaretskii
2012-05-03 22:34           ` Ludovic Courtès
2012-05-02  3:57 ` Daniel Hartwig
2012-05-03  5:14 ` Sunjoong Lee
2012-05-03 22:31 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).