Skip to content

NumberFormatter: Fix the pattern default .nostyle pattern for ICU62+ #1736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CoreFoundation/Locale.subproj/CFNumberFormatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ CFNumberFormatterRef CFNumberFormatterCreate(CFAllocatorRef allocator, CFLocaleR
CFRelease(memory);
return NULL;
}
UChar ubuff[4];

if (kCFNumberFormatterNoStyle == style) {
UChar ubuff[1];
status = U_ZERO_ERROR;
ubuff[0] = '#'; ubuff[1] = ';'; ubuff[2] = '#';
__cficu_unum_applyPattern(memory->_nf, false, ubuff, 3, NULL, &status);
ubuff[0] = '#';

__cficu_unum_applyPattern(memory->_nf, false, ubuff, 1, NULL, &status);
__cficu_unum_setAttribute(memory->_nf, UNUM_MAX_INTEGER_DIGITS, 42);
__cficu_unum_setAttribute(memory->_nf, UNUM_MAX_FRACTION_DIGITS, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ open class NumberFormatter : Formatter {
internal var _format: String?
open var format: String {
get {
return _format ?? "#;0;#"
return _format ?? "#"
}
set {
_reset()
Expand Down