- ## If there's no encoding for stdout then we're doing something stupid.
- if SYS.stdout.encoding is None: return len(s)
+ global DEFAULT_ENCODING
+
+ ## Figure out the default encoding.
+ if DEFAULT_ENCODING is None: DEFAULT_ENCODING = LC.getpreferredencoding()