<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Dear all</div><div class=""><br class=""></div><div class="">I've found a serious Bug in&nbsp;<a href="https://bugs.swift.org/browse/SR-6631" class="">JSONEncoder SR-6131</a>&nbsp;and would like to fix it.</div><div class="">This bug cause JSON encoding issues on Double when using a local that does not use dot as decimal separator e.g «&nbsp;fr_FR&nbsp;» (we use a coma)</div><div class=""><br class=""></div><div class="">Demonstration of the issue :&nbsp;</div><div class=""><br class=""></div><div class=""><pre class="code-java" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; color: rgb(51, 51, 51); font-size: 11px;"><span class="code-keyword" style="color: rgb(0, 0, 145);">import</span> Foundation

<span class="code-comment" style="color: rgb(128, 128, 128);">// Required to call setLocale
</span><span class="code-keyword" style="color: rgb(0, 0, 145);">import</span> Darwin

<span class="code-comment" style="color: rgb(128, 128, 128);">// Let's set to french
</span>setlocale(LC_ALL,<span class="code-quote" style="color: rgb(0, 145, 0);">"fr_FR"</span>)
&nbsp;
struct Shot:Codable{
&nbsp; &nbsp; let seconds:<span class="code-object" style="color: rgb(145, 0, 145);">Double</span>
}
&nbsp;
let shot = Shot(seconds: 1.1)
&nbsp;
<span class="code-keyword" style="color: rgb(0, 0, 145);">do</span>{
&nbsp; &nbsp; let data = <span class="code-keyword" style="color: rgb(0, 0, 145);">try</span> JSONEncoder().encode(shot)
&nbsp; &nbsp; <span class="code-keyword" style="color: rgb(0, 0, 145);">if</span> let json =&nbsp; <span class="code-object" style="color: rgb(145, 0, 145);">String</span>(data:data, encoding:.utf8){
&nbsp; &nbsp; &nbsp; &nbsp; <span class="code-comment" style="color: rgb(128, 128, 128);">// the result is : <span class="code-quote">"{"</span>seconds<span class="code-quote">":1,1000000000000001}&nbsp;»</span></span></pre><pre class="code-java" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; color: rgb(51, 51, 51); font-size: 11px;"><span class="code-comment" style="color: rgb(128, 128, 128);"><span class="Apple-tab-span" style="white-space:pre">        </span>// should be : <span class="code-quote">"{"</span>seconds<span class="code-quote">":1.1000000000000001}&nbsp;»</span>
</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class="code-comment" style="color: rgb(128, 128, 128);">// The decimal separator should not be <span class="code-quote">","</span> but <span class="code-quote">"."</span>
</span>&nbsp; &nbsp; &nbsp; &nbsp; print(json)
&nbsp; &nbsp; }
}<span class="code-keyword" style="color: rgb(0, 0, 145);">catch</span>{
&nbsp; &nbsp; print(<span class="code-quote" style="color: rgb(0, 145, 0);">"\(error)"</span>)
}
&nbsp;
exit(EX_OK)</pre><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I would like to propose my fix, test it and, but i’m not mastering the contribution mechanism.</div><div class=""><br class=""></div><div class="">Where should i start?&nbsp;</div><div class=""><br class=""></div><div class="">I ve forked&nbsp;<a href="https://github.com/benoit-pereira-da-silva/swift-corelibs-foundation" class="">https://github.com/benoit-pereira-da-silva/swift-corelibs-foundation</a></div><div class="">I have a very simple Unit test that demonstrates the issue.</div><div class=""><br class=""></div><div class="">How can i test my&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class=""><div class="" style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-size: 14px;"><div apple-content-edited="true" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span class="" style="font-size: 12px; line-height: normal; orphans: 2; widows: 2;"><font face="HelveticaNeue-Light" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; line-height: normal;"><b class="">Benoit Pereira da Silva</b></div><div class="" style="margin: 0px; line-height: normal;">Ultra Mobile Developer &amp; Movement Activist</div><div class="" style="margin: 0px; line-height: normal;">Développeur Ultra Mobile &amp; Militant du mouvement</div><div class="" style="margin: 0px; line-height: normal;"><a href="https://pereira-da-silva.com/" class="">https://pereira-da-silva.com</a></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="line-height: normal;"></span></div></div></div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span class=""></span></div></font></span></div></div></div></div></div></div><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><br class="Apple-interchange-newline" style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><img apple-inline="yes" id="3B99BECE-63F7-407E-8EBE-F254261AC391" class="" src="cid:E3AF4CA8-D774-47D1-AF27-2B086409AEED@home"><div class="" style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br class=""></span></span></div><div class="" style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><span style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><div class="" style="font-family: HelveticaNeue-Light; orphans: 2; widows: 2;"><div class=""><span class="" style="background-color: rgb(255, 255, 255);">✄&nbsp;--------------------------------</span><br class=""><font size="1" class="">This e-mail is confidential. Distribution, copy, publication or use of this information for any purpose is prohibited without agreement of the sender.<br class="">Ce message est confidentiel. Toute distribution, copie, publication ou usage des informations contenues dans ce message sont interdits sans agrément préalable&nbsp;de l’expéditeur.</font></div><div class=""><font size="1" class=""><br class=""></font></div><div class=""><br class=""></div></div></span></span></div></span></span></div></body></html>