<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 01.02.2012 18:50, <a class="moz-txt-link-abbreviated" href="mailto:pan@erlang.org">pan@erlang.org</a> wrote:
<blockquote
cite="mid:Pine.LNX.4.64.1202011729500.7630@arwen.otp.ericsson.se"
type="cite">Hi Erik!
<br>
</blockquote>
Can I expect that it will be seen as a bug and corrected in the next
version?<br>
<blockquote
cite="mid:Pine.LNX.4.64.1202011729500.7630@arwen.otp.ericsson.se"
type="cite">
<br>
You are absolutely right about that 'user' and 'group' are used in
different situations and that the names are utterly confusing.
'group' is used in *interactive shell sessions* and will determine
unicode mode from LOCALE/terminal settings, while 'user' is for
non interactive stdin/stdout (pipes, redirected files, dumb
terminals etc), in which case you *have to* set unicode mode
manually. Your first example will run the io:setopts before the
group server is fully initialized, why you will get an unexpected
behaviour. If you were to do the same when the interactive shell
was actually started, the behaviour would be as expected.
<br>
<br>
If opting to set unicode mode for an interactive session, set the
LOCALE correctly. If running a non interactive session, use
-oldshell or -noshell and do as in your second example.
<br>
<br>
The problem reported however, was easilly found. It is due to that
ssh_cli does not handle setting of unicode mode, which is a
problem in the ssh application (that does not fully handle
unicode). The internal protocol between io-server and ssh_cli will
call ssh_cli:handle_msg({Pid,set_unicode_state,true},State), which
is ignored by the ssh_cli code. Supporting unicode here could be
done by simply expecting the terminal in the other end to support
UTF8 characters if unicode mode was enabled, which would be the
same behaviour as in the 'user' io-server. That however requires a
fair amount of coding and the ssh application is far away from my
jurisdiction :)
<br>
<br>
Cheers,
<br>
/Patrik, OTP
<br>
<br>
<br>
On Tue, 31 Jan 2012, Erik Søe Sørensen wrote:
<br>
<br>
<blockquote type="cite">This is probably not related to SSH.
<br>
As was found out earlier on this list, the encoding behaviour
(confusingly) depends on how Erlang was started:
<br>
<br>
$ erl -eval 'ok = io:setopts([{encoding, unicode}]),
<br>
io:format("~p~n", [io:getopts()]), init:stop().'
<br>
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8]
<br>
[async-threads:0] [hipe] [kernel-poll:false]
<br>
<br>
Eshell V5.8.4 (abort with ^G)
<br>
1> [{expand_fun,#Fun<group.0.120017273>},
<br>
{echo,true},
<br>
{binary,false},
<br>
{encoding,latin1}]
<br>
$ erl -eval 'ok = io:setopts([{encoding, unicode}]),
<br>
io:format("~p~n", [io:getopts()]), init:stop().' -noinput
<br>
[{binary,false},{encoding,unicode}]
<br>
$ erl -eval 'ok = io:setopts([{encoding, unicode}]),
<br>
io:format("~p~n", [io:getopts()]), init:stop().' -noshell
<br>
[{binary,false},{encoding,unicode}]
<br>
<br>
This has do do with the fact that in one case, the 'group'
module handles I/O, while in the other case it's the 'user'
module.
<br>
(I don't know enough to say anything intelligent about why this
is, why two modules with overlapping functionality but different
encoding behaviour exist, or what their purposes are besides
handling I/O.)
<br>
<br>
On 31-01-2012 14:00, Fyodor Ustinov wrote:
<br>
<blockquote type="cite">Hi!
<br>
<br>
Unable to set encoding to unicode in ssh daemon session.
<br>
<br>
ok = io:setopts([{expand_fun, fun expand_prompt/1}, {encoding,
unicode}]),
<br>
io:format("~p~n", [io:getopts()])
<br>
<br>
say:
<br>
<br>
[{expand_fun,#Fun<group.0.33302583>},
<br>
{echo,true},
<br>
{binary,false},
<br>
{encoding,latin1}]
<br>
<br>
WBR,
<br>
Fyodor.
<br>
<br>
_______________________________________________
<br>
erlang-bugs mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
<br>
</blockquote>
<br>
<br>
-- <br>
Mobile: + 45 26 36 17 55 | Skype: eriksoesorensen | Twitter:
@eriksoe
<br>
Trifork A/S | Margrethepladsen 4 | DK-8000 Aarhus C |
<a class="moz-txt-link-abbreviated" href="http://www.trifork.com">www.trifork.com</a> <a class="moz-txt-link-rfc2396E" href="http://www.trifork.com/"><http://www.trifork.com/></a>
<br>
<br>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
</blockquote>
<br>
</body>
</html>