<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="">(moving to more relevant list)<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2017, at 08:51, Benoit Pereira da silva via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div 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}"</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 style="font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 14px;" class=""><div apple-content-edited="true" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-size: 12px; line-height: normal; orphans: 2; widows: 2;" class=""><font face="HelveticaNeue-Light" class=""><div style="orphans: auto; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><b class="">Benoit Pereira da Silva</b></div><div style="margin: 0px; line-height: normal;" class="">Ultra Mobile Developer &amp; Movement Activist</div><div style="margin: 0px; line-height: normal;" class="">Développeur Ultra Mobile &amp; Militant du mouvement</div><div style="margin: 0px; line-height: normal;" class=""><a href="https://pereira-da-silva.com/" class="">https://pereira-da-silva.com</a></div><div style="margin: 0px; line-height: normal;" class=""><span style="line-height: normal;" class=""></span></div></div></div><div style="orphans: auto; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class=""></span></div></font></span></div></div></div></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span id="cid:E3AF4CA8-D774-47D1-AF27-2B086409AEED@home">&lt;bannerp.jpg&gt;</span></span><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; 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-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class=""><span class=""><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br class=""></span></span></span></span></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; 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-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class=""><span class=""><div style="font-family: HelveticaNeue-Light; orphans: 2; widows: 2;" class=""><div class=""><span style="orphans: auto; widows: auto; background-color: rgb(255, 255, 255);" class="">✄&nbsp;--------------------------------</span><br style="orphans: auto; widows: auto;" class=""><font size="1" style="orphans: auto; widows: auto;" 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><br style="orphans: auto; widows: auto;" class=""></div></div></span></span></span></span></div><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;">
</span></span></span></span></span></span></span></span></span></div>
<br class=""></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>