Works For Me (TM).

user=> (def s "québécois français")
#'user/s
user=> (print s)
québécois françaisnil

Are you running on Windows, Mac, or Linux? Using the Sun JVM? Which revision
of Clojure?

p...@pstadig-laptop:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 8.10
Release:    8.10
Codename:    intrepid

p...@pstadig-laptop:~$ java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

p...@pstadig-laptop:~/clojure$ svn info
Path: .
URL: http://clojure.googlecode.com/svn/trunk
Repository Root: http://clojure.googlecode.com/svn
Repository UUID: a41a16f3-9855-0410-b325-31a011a03e7c
Revision: 1336
Node Kind: directory
Schedule: normal
Last Changed Author: richhickey
Last Changed Rev: 1335
Last Changed Date: 2009-03-19 09:51:32 -0400 (Thu, 19 Mar 2009)


Paul

On Fri, Apr 3, 2009 at 10:57 AM, Daniel Jomphe <danieljom...@gmail.com>wrote:

>
> Now that I know for sure how to bind *out* to something else over
> System/out, it's time to bring back my encoding issues into scope:
>
>  (import '(java.io PrintWriter PrintStream))
>
>  (defmacro with-out-encoded
>    [encoding & body]
>    `(binding [*out* (java.io.PrintWriter. (java.io.PrintStream.
> System/out true ~encoding) true)]
>              ~...@body
>              (flush)))
>
>  (def nc "ISO-8859-1")
>
>  ;;; with a normal string
>  (def s "québécois français")
>
>  (print s)
>  ; quÔøΩbÔøΩcois franÔøΩaisnil
>
>  (with-out-encoded nc (print s))
>  ; qu?b?cois fran?aisnil
>
>  ;;; with a correctly-encoded string
>  (def snc (String. (.getBytes s nc) nc))
>
>  (print snc)
>  ; qu?b?cois fran?aisnil
>
>  (with-out-encoded nc (print snc))
>  ; qu?b?cois fran?aisnil
>
> I'm certainly missing something fundamental somewhere.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to