# HG changeset patch # User Ludovic Chabant # Date 1420256861 28800 # Node ID 0a1736ef740d53305c76af5015da8a83939530ec # Parent c132a2cba5218d1142f0e4be8d78ce0091c29473 chef: Work around a bug in MacOSX where the default locale doesn't work. diff -r c132a2cba521 -r 0a1736ef740d piecrust/main.py --- a/piecrust/main.py Thu Jan 01 23:13:38 2015 -0800 +++ b/piecrust/main.py Fri Jan 02 19:47:41 2015 -0800 @@ -52,6 +52,16 @@ def main(): + if sys.platform == 'darwin': + # There's a bug on MacOSX that can cause Python to be confused + # about the locale. Let's try to fix that. + # See: http://bugs.python.org/issue18378 + import locale + try: + locale.getdefaultlocale() + except ValueError: + locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') + argv = sys.argv pre_args = _pre_parse_chef_args(argv) try: