<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>That's true for <a class="moz-txt-link-freetext">file:consult</a>,
but</p>
<p>the user who want to edit the file will see <br>
</p>
<p>{"cn",[28450]}.</p>
<p>and not</p>
<p>{"cn","<span style="font-family:"MS Gothic"">漢</span>"}.</p>
<p>So, for the user it's different!</p>
<p>What is the right way to save?</p>
<p>Regards,</p>
<p> Oliver</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 27.01.21 00:01, Michał Muskała
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:DB7PR07MB3899729D01C972D621EFD9FCFABC0@DB7PR07MB3899.eurprd07.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"\@MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Those
two values are exactly the same. Lists of integers
representing codepoints and strings are two ways of
representing the same value. Reading back with <a class="moz-txt-link-freetext" href="file:consult">file:consult</a>
should reproduce exactly the same values.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">$
erl<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Erlang/OTP
23 [erts-11.1.5] [source] [64-bit] [smp:16:16] [ds:16:16:10]
[async-threads:1] [hipe] [dtrace]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Eshell
V11.1.5 (abort with ^G)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">1>
{"cn",[28450]} =:= {"cn","</span><span
style="font-family:"MS
Gothic";mso-fareast-language:EN-US" lang="EN-US">漢</span><span
style="mso-fareast-language:EN-US">"}.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">true<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">2>
io:format("~tp.\n",[{"cn","</span><span
style="font-family:"MS
Gothic";mso-fareast-language:EN-US" lang="EN-US">漢</span><span
style="mso-fareast-language:EN-US">"}]).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">{"cn",[28450]}.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">ok<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">If
you’re asking if you can make io:format print the string
representation rather than list one for high-codepoint
characters, the answer is you can, by starting the VM in
Unicode mode with +pc unicode flag:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">$
erl +pc unicode<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Erlang/OTP
23 [erts-11.1.5] [source] [64-bit] [smp:16:16] [ds:16:16:10]
[async-threads:1] [hipe] [dtrace]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Eshell
V11.1.5 (abort with ^G)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"
lang="PL">1> io:format("~tp.\n",[{"cn","</span><span
style="font-family:"MS
Gothic";mso-fareast-language:EN-US" lang="EN-US">漢</span><span
style="mso-fareast-language:EN-US" lang="PL">"}]).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">{"cn","</span><span
style="font-family:"MS
Gothic";mso-fareast-language:EN-US" lang="EN-US">漢</span><span
style="mso-fareast-language:EN-US">"}.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">ok<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Michał.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">erlang-questions
<a class="moz-txt-link-rfc2396E" href="mailto:erlang-questions-bounces@erlang.org"><erlang-questions-bounces@erlang.org></a> on behalf of
Oliver Bollmann <a class="moz-txt-link-rfc2396E" href="mailto:oliver.bollmann@t-online.de"><oliver.bollmann@t-online.de></a><br>
<b>Date: </b>Tuesday, 26 January 2021 at 22:52<br>
<b>To: </b>Erlang-Questions Questions
<a class="moz-txt-link-rfc2396E" href="mailto:erlang-questions@erlang.org"><erlang-questions@erlang.org></a><br>
<b>Subject: </b>Write Term to File<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">How can i
write term to file, for later using in <a class="moz-txt-link-freetext" href="file:consult">file:consult</a>?<br>
<br>
I do:<br>
<br>
R = io_lib:format("~tp.",[{"cn","<span
style="font-family:"MS Gothic"">漢</span>"}]),<br>
<a class="moz-txt-link-freetext" href="file:write_file(FileName,R)">file:write_file(FileName,R)</a><br>
<br>
But this gives:<br>
<br>
{"cn",[28450]}.<br>
<br>
I need:<br>
<br>
{"cn","<span style="font-family:"MS Gothic"">漢</span>"}.<br>
<br>
Any hints?<br>
<br>
-- <br>
Grüße<br>
Oliver Bollmann<o:p></o:p></p>
</div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Grüße
Oliver Bollmann</pre>
</body>
</html>