admin管理员组

文章数量:1024616

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 ─┐ │
│ │

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 ─┐ │
│ │

本文标签: windowsfastapi dev fails with UnicodeEncodeErrorStack Overflow