[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I'm looking for a method of converting a string's character encoding
From: |
Sunjoong Lee |
Subject: |
I'm looking for a method of converting a string's character encoding |
Date: |
Sat, 28 Apr 2012 06:13:47 +0900 |
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.
- I'm looking for a method of converting a string's character encoding,
Sunjoong Lee <=
- Re: I'm looking for a method of converting a string's character encoding, Sunjoong Lee, 2012/04/27
- Re: I'm looking for a method of converting a string's character encoding, Sunjoong Lee, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Thien-Thi Nguyen, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Daniel Krueger, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Thien-Thi Nguyen, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Eli Zaretskii, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Sunjoong Lee, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Sunjoong Lee, 2012/04/28
- Re: I'm looking for a method of converting a string's character encoding, Daniel Krueger, 2012/04/30
- Re: I'm looking for a method of converting a string's character encoding, Eli Zaretskii, 2012/04/30