<div dir="ltr">It is because one of the integers in y (155) is not considered printable by Erlang.<br><br><span style="font-family: courier new,monospace;">17> X = "\326\320\271\372". </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">"\326\320\271\372"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">18> Y = [228,184,173,229,155,189]. </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[228,184,173,229,155,189]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">19> [{I, io_lib:printable_list([I])} || I <- X].</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[{214,true},{208,true},{185,true},{250,true}]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">20> [{I, io_lib:printable_list([I])} || I <- Y].</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[{228,true},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {184,true},</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> {173,true},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {229,true},</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> {155,false},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {189,true}]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">21> </span><br style="font-family: courier new,monospace;"><br><div class="gmail_quote">2008/9/29 devdoer bird <span dir="ltr"><<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><div>HI:</div>
<div> </div>
<div>I have a utf8 encoded file y.erl: the source is :</div>
<div>-module(y).<br>-compile(export_all).<br>output2()-><br> "中文".</div>
<div> </div>
<div> </div>
<div>And a latin encoded file x.erl, the source is:</div>
<div>
<div>-module(x).<br>-compile(export_all).<br>output2()-><br> "中文".</div>
<div> </div>
<div>When execute them in erlang shell,</div>
<div>1> x:output2().</div>
<div>"\326\320\271\372"</div>
<div>2>y:output2().</div>
<div>[228,184,173,229,155,189]</div>
<div> </div>
<div>I don't know why they are outupted in diffrent format, one is string-format, the other is list-format. Why aren't they birth outputed in string-format or both in list-format?</div>
<div> </div>
<div> </div></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div>