Skip to content

Commit

Permalink
Make it a bit harder to run into the LC_ALL thing
Browse files Browse the repository at this point in the history
This behavior is stupid. Respecting LC_ALL, or anything else for that
matter, over the encoding fucking noted in the fucking file is a bad
decision, and someone should feel bad. I don't know why it makes things
break in the specific and bizarre way it does, but it does, and there's
no possible good reason for it.

Closes sopel-irc#984. Fuck.
  • Loading branch information
embolalia committed Jan 17, 2016
1 parent 902e715 commit b73fc6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions contrib/sopel.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ExecStart=/usr/bin/sopel -c /etc/sopel.cfg
Restart=on-failure
RestartPreventExitStatus=2
RestartSec=30
Environment=LC_ALL=en_US.UTF-8

[Install]
WantedBy=multi-user.target
15 changes: 13 additions & 2 deletions sopel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# coding=utf-8
# ASCII ONLY IN THIS FILE THOUGH!!!!!!!
# Python does some stupid bullshit of respecting LC_ALL over the encoding on the
# file, so in order to undo Python's ridiculous fucking idiocy, we have to have
# our own check.

# Copyright 2008, Sean B. Palmer, inamidst.com
# Copyright 2012, Elsie Powell, http://embolalia.com
# Copyright © 2012, Elad Alfassa <[email protected]>
# Copyright 2012, Elad Alfassa <[email protected]>
#
# Licensed under the Eiffel Forum License 2.

from __future__ import unicode_literals, absolute_import, print_function, division
import os
import sys
if hasattr(os, "getenv") and os.getenv("LC_ALL") == "C":
print('WARNING!!! LC_ALL is set to "C", which makes Python do stupid '
'things. If you get strange errors, please unset it, or set it to '
'something like "en_US.UTF-8".', file=sys.stderr)


from collections import namedtuple
import os
import re
import time
import traceback
Expand Down

0 comments on commit b73fc6a

Please sign in to comment.