最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

windows - fastapi dev fails with UnicodeEncodeError - Stack Overflow

matteradmin6PV0评论

After installing FastAPI as documented, the command fastapi dev fastapi_app/ fails with

| +-------------------------------- locals ---------------------------------+ | | | final = False | | | | input = '\U0001f4c1 gpt-oe-rfq-automation'
| | | | self = <encodings.cp1252.IncrementalEncoder object at
| | | | 0x0000024661D35D50>
| | | +-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------+ UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f4c1' in position 0: character maps to <undefined>

on git bash in Windows for Python 3.11 and 3.12.

How can this be fixed ?

After installing FastAPI as documented, the command fastapi dev fastapi_app/ fails with

| +-------------------------------- locals ---------------------------------+ | | | final = False | | | | input = '\U0001f4c1 gpt-oe-rfq-automation'
| | | | self = <encodings.cp1252.IncrementalEncoder object at
| | | | 0x0000024661D35D50>
| | | +-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------+ UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f4c1' in position 0: character maps to <undefined>

on git bash in Windows for Python 3.11 and 3.12.

How can this be fixed ?

Share Improve this question asked Nov 18, 2024 at 12:22 serv-incserv-inc 38.4k9 gold badges191 silver badges212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

As documented in https://stackoverflow/a/63573649/1587329, this can be fixed by setting

export PYTHONIOENCODING=utf-8

in the shell. Afterwards, the message changes to [...]

┌─ Python package file structure ─┐ │
│ │

Post a comment

comment list (0)

  1. No comments so far