[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

specifying source encoding (Re: strings draft)

From: Alex Shinn <foof@xxxxxxxxxxxxx>
Subject: Re: strings draft
Date: Mon, 09 Feb 2004 10:45:37 +0900

> I was just suggesting it can be useful to have a way to specify the
> character encoding of Scheme source, a separate issue from locale, much
> like the XML:
>   <?xml encoding="utf-8"?>
> However, in retrospect SRFI-10 is a poor way to implement this because
> it means you can't read the whole list and then dispatch on ENCODING.
> Probably best to directly copy XML style and have something similar to
> SRFI-22 specifying the encoding at the top of the file, perhaps hidden
> in a comment a la Emacs:
>   ;; -*- encoding: UTF-8 -*-

Programming in multiple encodings, I've been thinking this for a while.
Currently I'm looking at using comment or some special directive like
(declare (source-encoding "utf-8")) 

Python adopted encoding-specifying comment, e.g.

    # -*- coding: <encoding name> -*-

see http://www.python.org/peps/pep-0263.html for the details.