<div dir="ltr">I would guess probably because Erlang uses ISO/IEC 8859-1, in which 155 is not defined while the others all are (<a href="http://en.wikipedia.org/wiki/ISO_8859-1#Codepage_layout">http://en.wikipedia.org/wiki/ISO_8859-1#Codepage_layout</a>). Characters between 137 and 159 are excluded, while all the rest are printable included.<br>
<br><div class="gmail_quote">2008/9/30 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>OK. Then I 'll take a look at it io_lib.erl. But one more question: why the value 155 is unprintable while 228 is , considering they are both greater than 128.</div>
<div> </div>
<div>Thanks.<br><br></div>
<div class="gmail_quote">2008/9/30 Edwin Fine <span dir="ltr"><<a href="mailto:erlang-questions_efine@usa.net" target="_blank">erlang-questions_efine@usa.net</a>></span><div><div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<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;">
<div><span style="font-family: courier new,monospace;">[228,184,173,229,155,189]</span><br style="font-family: courier new,monospace;"></div><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" target="_blank">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>
<div></div>
<div>
<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></div></div>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org" target="_blank">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></blockquote></div></div></div><br></div>
</blockquote></div><br></div>