Skip to content

Commit

Permalink
Cache and restore system LC_CTYPE option after all other locales are set
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkleiner committed Aug 16, 2023
1 parent 76429dc commit c783536
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/Intl/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ public static function setLocale($locale)
$newLocale[] = $localeVariant;
}
}


$systemLC_CTYPE = setlocale(LC_CTYPE, 0);
setlocale(LC_ALL, $newLocale);
setlocale(LC_CTYPE, '');
setlocale(LC_CTYPE, $systemLC_CTYPE);
// Always use english for numbers. otherwise the decimal separator might get localized when casting a float to string
setlocale(LC_NUMERIC, array('en_US.UTF-8', 'en-US', 'C.UTF-8', 'C'));
}
Expand Down

0 comments on commit c783536

Please sign in to comment.