Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  Strings handled differently in the shell and compiled module

nem
Posted: Thu Feb 18, 2010 10:28 pm Reply with quote
User Joined: 29 Nov 2007 Posts: 25
I've just been working on some code and came across a surprising result
and wonder if it's a bug.

If I create a module with a unicode string:

%%%%%
-module(unitest).
-export([test/0]).

test() ->
"©|®|™|[\\-\\.!,]".
%%%%%

Then the following is true in the shell:
unitest:test() =/= "©|®|™|[\\-\\.!,]".

That is, the string literal in the module is a list of utf-8 bytes and
the shell string literal is a list of unicode codepoints; string
literals have a different value depending on their context.

Have I simply missed something in the documentation that says this is
the expected behaviour? If not, then it'd be nice if shell code and
module code behaved as similarly as possible.

Cheers,
--
Geoff Cant

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
View user's profile Send private message
Guest
Posted: Fri Feb 19, 2010 1:01 pm Reply with quote
Guest
On Thu, Feb 18, 2010 at 02:27:32PM -0800, Geoff Cant wrote:
>
> I've just been working on some code and came across a surprising result
> and wonder if it's a bug.
>
> If I create a module with a unicode string:
>
> %%%%%
> -module(unitest).
> -export([test/0]).
>
> test() ->
> "

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum