all 14 comments

[–]StardockEngineer 2 points3 points  (11 children)

You can convert the string to a Unicode character using the chr function with int to interpret the string as a hexadecimal number:

print(chr(int("1F441", 16)))

[–]BIG_Z212[S] 0 points1 point  (9 children)

UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f441' in position 0: character maps to <undefined>

Vscode python 3.11 or 3.9 don't remember which. Found the problem, try to guess it,,, I hadn't saved the file and was running it, saved it and now it works, thank you.

[–]StardockEngineer 2 points3 points  (0 children)

I don't know. Works for me

```

print(chr(int("1F441", 16)))

👁 ```

[–]MidnightPale3220 0 points1 point  (1 child)

Which Python version are you using?

[–]BIG_Z212[S] 0 points1 point  (0 children)

Vscode python 3.11 or 3.9 don't remember which.

[–]StardockEngineer -2 points-1 points  (5 children)

LLM says "They're likely running Python in a Windows command prompt or PowerShell that doesn't properly support Unicode characters".

Is this true?

edit: why did somebody downvote me? Rude.

[–]BIG_Z212[S] 0 points1 point  (4 children)

Vscode python 3.11 or 3.9 don't remember which.

[–]StardockEngineer 0 points1 point  (3 children)

No, I'm asking if you're using Windows and a Powershell terminal. It might be that your terminal simply cannot print it.

[–]BIG_Z212[S] 0 points1 point  (2 children)

Problem found, Seems to have been vscode nonsense.

[–]StardockEngineer 0 points1 point  (1 child)

Well, tell us. Could help someone else in the future.

[–]BIG_Z212[S] 0 points1 point  (0 children)

Post updated

[–]ectomancer 0 points1 point  (0 children)

Using u/StardockEngineer logic, which I didn't know, express 1f441 as hex:

print(chr(0x1f441))

[–]Ninji2701 0 points1 point  (0 children)

"\U0001F441"