[melbourne-pug] Unicode for windows dummies

William ML Leslie william.leslie.ttg at gmail.com
Tue Aug 16 00:30:06 EDT 2016


On 16 August 2016 at 14:24, Anthony Briggs <anthony.briggs at gmail.com> wrote:
> Hi Mike,
>
> I was just trying to solve a similar problem at the PyconAU sprints :)
>
> The error is that there are some things / Unicode strings which don't
> translate to Windows 'charmap' characters, and can't be printed to the
> terminal. You can replicate it with this code:
>
> print("M├┐ h├┤v├¿r├ºr├áft ├«├ƒ f├╗┼él ├Âf ├®├¬l┼ø".encode("cp1252"))

The print() is redundant here, the function call is never reached;
this is different to the example, where it is the print itself that is
failing.

print("M├┐ h├┤v├¿r├ºr├áft ├«├ƒ f├╗┼él ├Âf ├®├¬l┼ø")

will also reproduce the error, but for a different reason: stdout now
fails to encode.

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law.  You absolutely MAY reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in.  Any attempt to DENY YOU THOSE RIGHTS would be illegal without
prior contractual agreement.


More information about the melbourne-pug mailing list