Marlon
Marlon

Reputation: 207

Python wrong output of currency symbol on server

I want to display currencies using a really simple python script:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import logging

if __name__ == '__main__':
    print('€')

On my local computer, everything works fine when I run the script with powershell.

If I run the same script on my Windows Server 2008 however, the output is a question mark (?).

I tried all solutions from this answer without success: https://stackoverflow.com/a/39936499/4437149.

Since im new to python I cant figure out whats exactly wrong.

Is there something missing in my script or any server misconfiguration? Im using the newest version of python (currently 3.8.0).

Upvotes: 1

Views: 251

Answers (1)

Pedro Lobito
Pedro Lobito

Reputation: 99051

Update:

Setting the terminal font to "Lucida Console" seems to be the solution.


Old Answer:

On windows, you may want to use an escape sequence (aka Python source code, aka code point), i.e.:

print("\u20AC") # Euro
print("\u0024") # Dollar
print("\u00A3") # Pound
print("\u00A5") # Yen

€
$
£
¥

References:

Upvotes: 1

Related Questions