Re: I'm looking for a method of converting a string's character encoding

2012-05-04 Thread Ludovic Courtès
Hi, Daniel Krueger skribis: > The only thing I'm not sure about is whether guile supports encoding a > string (into a bytevector) in some other format than UTF-8 It does, by virtue of mixed binary/textual ports (see my previous message.) Thanks, Ludo’.

Re: I'm looking for a method of converting a string's character encoding

2012-05-04 Thread Ludovic Courtès
Hi, Sunjoong Lee skribis: > 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&q

Re: I'm looking for a method of converting a string's character encoding

2012-05-02 Thread Sunjoong Lee
Hi, Daniel; 2012/4/28 Daniel Hartwig > > Can you provide us with a couple of sites where http-get or > decode-string does not work properly? Or was something else at play > here? This would help to investigate what the issue is. (I am lazy > today to find some, I think you must know of a few :

Re: I'm looking for a method of converting a string's character encoding

2012-05-01 Thread Daniel Hartwig
On 28 April 2012 05:13, Sunjoong Lee wrote: > > 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 occur

Re: I'm looking for a method of converting a string's character encoding

2012-04-30 Thread Eli Zaretskii
> Date: Mon, 30 Apr 2012 12:18:59 +0200 > From: Daniel Krueger > Cc: t...@gnuvola.org, guile-user@gnu.org, sunjo...@gmail.com > > I think strings should be encoding `independent', so you don't have to > mind that if you don't need to, and if you're working with a special > encoding you're working

Re: I'm looking for a method of converting a string's character encoding

2012-04-30 Thread Daniel Krueger
On Sat, Apr 28, 2012 at 10:55 PM, Eli Zaretskii wrote: > One notable example is when the original encoding was determined > incorrectly, and the application wants to "re-decode" the string, when > its external origin is no longer available. Okay, but then I would suggest either if you know you're

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Sunjoong Lee
Only supporting UTF-8 is still strange but I understand why Daniel said so now. After these two line appending, most of my problem on http-get was solved: (set-port-encoding! (current-output-port) "UTF-8") (fluid-set! %default-port-encoding "UTF-8") This is like a magic!! I think it's better to a

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Sunjoong Lee
Thanks hien-Thi, Daniel and Eli. Eli pointed a good example; I'll say another one. In the countries, it's character encoded multibytes, like China, Japan and Korea (i.e., in CJKs), it would be a common issue to convert codeset. In Korea, a certain web page may be written by EUC-KR codeset and anot

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Eli Zaretskii
> Date: Sat, 28 Apr 2012 20:29:22 +0200 > From: Daniel Krueger > Cc: guile-user@gnu.org, Sunjoong Lee > > i think there shouldn't be any transcoding of guile's strings, as > strings are internal representation of characters, no matter how they > are encoded. So the only time when encoding matter

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Daniel Krueger
Hi, i think there shouldn't be any transcoding of guile's strings, as strings are internal representation of characters, no matter how they are encoded. So the only time when encoding matters is when it passes it's `internal boundarys', i mean if you write the string to a port or read from a port

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Thien-Thi Nguyen
() Daniel Krueger () Sat, 28 Apr 2012 20:29:22 +0200 i think there shouldn't be any transcoding of guile's strings, as strings are internal representation of characters, no matter how they are encoded. So the only time when encoding matters is when it passes it's `internal boundarys',

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Thien-Thi Nguyen
() Sunjoong Lee () Sun, 29 Apr 2012 01:38:28 +0900 http-get is innocent but I need encoding converter yet. It sounds like a good exercise (that would flush out bugs and raise confidence in the infrastructure) would be to implement an iconv-workalike program in Scheme. Maybe one already exist

Re: I'm looking for a method of converting a string's character encoding

2012-04-28 Thread Sunjoong Lee
http-get is innocent but I need encoding converter yet. In front-of my program, after appending a line (set-port-encoding! (current-output-port) "utf-8") , the contents body string of web page displayed well. With with-fluids and %default-port-encoding, I can use html->sxml . But contents of outpu

Re: I'm looking for a method of converting a string's character encoding

2012-04-27 Thread Sunjoong Lee
Are file-port and string-port much different? I can convert strings in file but I want not to use file. My terminal charset is utf-8. Suppose there be a "XXX" encoded text file "a.txt", it would be converted like this: (use-modules (ice-9 rdelim)) (set-port-encoding! (current-output-port) "utf-8")

I'm looking for a method of converting a string's character encoding

2012-04-27 Thread Sunjoong Lee
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