Re: escaping characters

2012-11-01 Thread Kejia柯嘉
hi all,

for an example, when a program reads in a latex source, is there an
escape function that can rewrite all `\' to `\\', `"' to `\"', and so
on?

thank you.

kejia

☵☯☲


2012/10/31 Ludovic Courtès :
> Hi,
>
> Kejia柯嘉  skribis:
>
>> is there a function that can escape of a string every character which
>> is an escape character?
>
> What do you mean by “escape character”?
>
> Ludo’.
>
>



Re: escaping characters

2012-11-01 Thread Thien-Thi Nguyen

() Kejia柯嘉 
() Thu, 1 Nov 2012 10:24:52 -0400

   for an example, when a program reads in a latex source, is there an
   escape function that can rewrite all `\' to `\\', `"' to `\"', and so
   on?

This kind of escaping for backslash and double-quote (and other chars,
depending on Guile flavor) is built-in for ‘(object->string STRING)’,
but anything else (the "and so on" bit) you have to define for yourself,
or find something already defined.

For example, Guile-BAUX provides module ‘(guile-baux write-string)’
which exports proc ‘write-string’ that handles twelve additional
characters:

http://www.gnuvola.org/software/guile-baux/guile-baux.html.gz#write_002dstring 

Another example is Guile-PG module ‘(database postgres-qcons)’, which
has all manner of procs to DTRT for various "and so on" cases:

http://www.nongnu.org/guile-pg/doc/qcons-quoting.html#qcons-quoting   

I think it would be nice for these procs (and perhaps your LaTeX
oriented one, once defined) to be rebased onto a general one, hosted
apart from any particular Guile version (perhaps Guile-Lib -- is that
project still viable?).

Or maybe i'm missing something already out there by now.  I remember
fruitlessly searching a number of years back, but things may have
changed since then.  Here's some related discussion:

http://lists.gnu.org/archive/html/guile-user/2012-01/msg00114.html

[cc trimmed]

-- 
Thien-Thi Nguyen . GPG key: 4C807502
.  NB: ttn at glug dot org is not me   .
. (and has not been since 2007 or so)  .
.ACCEPT NO SUBSTITUTES .
... please send technical questions to mailing lists ...



pgpfC3hCAcbuH.pgp
Description: PGP signature


Re: escaping characters

2012-11-01 Thread Noah Lavine
This is related to what ttn said, but I am a bit confused by the request.
Normally when you read *in* something like LaTeX source, you convert \\ to
\, and similar things. Then when you write *out* LaTeX source, you might
convert \ to \\. This is useful if, for instance, you want Guile to
automatically generate some LaTeX and then write it in a form that TeX will
read. Kejia seems to be asking for the opposite.

I certainly agree that it would be useful to have a general function for
this (and the reverse).

Noah


On Thu, Nov 1, 2012 at 2:14 PM, Thien-Thi Nguyen  wrote:

>
> () Kejia柯嘉 
> () Thu, 1 Nov 2012 10:24:52 -0400
>
>for an example, when a program reads in a latex source, is there an
>escape function that can rewrite all `\' to `\\', `"' to `\"', and so
>on?
>
> This kind of escaping for backslash and double-quote (and other chars,
> depending on Guile flavor) is built-in for ‘(object->string STRING)’,
> but anything else (the "and so on" bit) you have to define for yourself,
> or find something already defined.
>
> For example, Guile-BAUX provides module ‘(guile-baux write-string)’
> which exports proc ‘write-string’ that handles twelve additional
> characters:
>
>
> http://www.gnuvola.org/software/guile-baux/guile-baux.html.gz#write_002dstring
>
> Another example is Guile-PG module ‘(database postgres-qcons)’, which
> has all manner of procs to DTRT for various "and so on" cases:
>
> http://www.nongnu.org/guile-pg/doc/qcons-quoting.html#qcons-quoting
>
> I think it would be nice for these procs (and perhaps your LaTeX
> oriented one, once defined) to be rebased onto a general one, hosted
> apart from any particular Guile version (perhaps Guile-Lib -- is that
> project still viable?).
>
> Or maybe i'm missing something already out there by now.  I remember
> fruitlessly searching a number of years back, but things may have
> changed since then.  Here's some related discussion:
>
> http://lists.gnu.org/archive/html/guile-user/2012-01/msg00114.html
>
> [cc trimmed]
>
> --
> Thien-Thi Nguyen . GPG key: 4C807502
> .  NB: ttn at glug dot org is not me   .
> . (and has not been since 2007 or so)  .
> .ACCEPT NO SUBSTITUTES .
> ... please send technical questions to mailing lists ...
>
>


how to decode uri containing non-ascii characters?

2012-11-01 Thread Kejia柯嘉
hi all,

in an html textarea, i input some chinese text, and receive the text from
the http request body. i tried to use uri-decode to restore the text, but
failed:
(display (uri-decode "%E5%B0%8F"))

any suggestions?

thanks a lot for your helps.

kejia

☵☯☲


Re: how to decode uri containing non-ascii characters?

2012-11-01 Thread nalaginrut
On Thu, 2012-11-01 at 20:03 -0400, Kejia柯嘉 wrote:
> hi all,
> 
> in an html textarea, i input some chinese text, and receive the text from
> the http request body. i tried to use uri-decode to restore the text, but
> failed:
> (display (uri-decode "%E5%B0%8F"))
> 

It's OK in my system.
--cut---
scheme@(guile-user)> (display (uri-decode "%E5%B0%8F"))
小scheme@(guile-user)> 
--end---

Can you show the error message?

> any suggestions?
> 
> thanks a lot for your helps.
> 
> kejia
> 
> ☵☯☲