unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: msematman@myopera.com
Cc: guile-user@gnu.org
Subject: Re: displaying UTF8 characters in and out of a script (guile 2.0.5)
Date: Sun, 16 Dec 2012 18:04:52 -0200	[thread overview]
Message-ID: <20121216180452.0820b094@capac> (raw)
In-Reply-To: <1355685754.7015.140661166743981.0F8ECFCA@webmail.messagingengine.com>

Hello,

> However, the same command in a script:
> 
> #!/usr/bin/guile \
> -s
> #!
> (display "Ćićolina")
> 
> writes this out: ?i?olina

you need to set the port encoding first [for further info see section '6.14.1 Ports'
of the manual]:


	#!/bin/sh
	# -*- mode: scheme; coding: utf-8 -*-
	exec guile -e main -s $0 "$@"
	!#

	(define (main args)
	  (let ((port (current-output-port)))
	    (set-port-encoding! port "utf-8")
	    (display "Ćićolina\n" port)))

Cheers,
David



  reply	other threads:[~2012-12-16 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 19:22 displaying UTF8 characters in and out of a script (guile 2.0.5) msematman
2012-12-16 20:04 ` David Pirotte [this message]
2012-12-16 20:31   ` Mark H Weaver
2012-12-17 12:18     ` msematman
2013-01-13 11:02     ` Andy Wingo
2013-01-13 18:12       ` Mark H Weaver
2013-01-13 22:09       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121216180452.0820b094@capac \
    --to=david@altosw.be \
    --cc=guile-user@gnu.org \
    --cc=msematman@myopera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).