Bug 214546

Summary: Intl NumberFormat style currency incorrect format for 'es-CA' CAD
Product: WebKit Reporter: Illia Bilichenko <tglm22>
Component: WebCore JavaScriptAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: webkit-bug-importer, ysuzuki, zmicerboksha
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: Unspecified   
Attachments:
Description Flags
Intl.NumberFormat problem none

Description Illia Bilichenko 2020-07-20 02:16:03 PDT
Facing different results of currency format for locale 'es-CA' and CAD currency.

In Chrome(84.0.4147.89) and Firefox(78.0.2):
Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD" }).format(100.0) --> "100,00 CA$"

In Safari(14.0) & Webkit build(r264591):
Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD" }).format(100.0) --> "$110.00"

Unfortunately, I can't find any specification how it showed be formated. Is it expected behavior?
Comment 1 Radar WebKit Bug Importer 2020-07-27 02:16:15 PDT
<rdar://problem/66152350>
Comment 2 Dmitry Boksha 2020-07-27 05:41:25 PDT
I have a similar situation with 
Intl.NumberFormat('fr-US', { style: 'currency', currency: 'USD' }).format(99999999)

Chrome (84.0.4147.89) and Firefox (78.0.2)  --> "99 999 999,00 $US"
Safari (Version 13.1.2 (15609.3.5.1.3) --> "99999999,00 $US"
Comment 3 Dmitry Boksha 2020-07-27 05:44:10 PDT
Created attachment 405267 [details]
Intl.NumberFormat problem

But something interesting happens when I'm trying to select or copy/paste value.
Comment 4 Yusuke Suzuki 2020-07-29 11:51:34 PDT
Thanks for your reporting!

(In reply to Illia Bilichenko from comment #0)
> Facing different results of currency format for locale 'es-CA' and CAD
> currency.
> 
> In Chrome(84.0.4147.89) and Firefox(78.0.2):
> Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD"
> }).format(100.0) --> "100,00 CA$"
> 
> In Safari(14.0) & Webkit build(r264591):
> Intl.NumberFormat("es-CA", { style: 'currency', currency: "CAD"
> }).format(100.0) --> "$110.00"
> 
> Unfortunately, I can't find any specification how it showed be formated. Is
> it expected behavior?

Yes, both are right and expected behaviors because CAD's code is $.

(In reply to Dmitry Boksha from comment #3)
> Created attachment 405267 [details]
> Intl.NumberFormat problem
> 
> But something interesting happens when I'm trying to select or copy/paste
> value.

Strictly speaking, this is not WebKit's issue. They are bugs in ICU (https://github.com/unicode-org/icu).
Firefox and Chrome are bundling the latest ICU. Safari is using ICU which is installed in the system (macOS etc.).
If you upgrade the system, you will see the updated behavior in Safari.

I've tested these things with ToT JavaScriptCore with Big Sur beta 3 and ensured that they are now fixed because ICU is updated by the system update.