Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'utf-8' codec can't encode characters in position 1297-1298: surrogates not allowed #667

Open
Cupcc opened this issue Feb 6, 2025 · 0 comments

Comments

@Cupcc
Copy link

Cupcc commented Feb 6, 2025

git diff | sgpt "Generate git commit message, for my changes"

 D:\sdk\miniconda3\Lib\site-packages\httpx\_content.py:179 in encode_json                         │
│                                                                                                  │
│   176 def encode_json(json: Any) -> tuple[dict[str, str], ByteStream]:                           │
│   177 │   body = json_dumps(                                                                     │
│   178 │   │   json, ensure_ascii=False, separators=(",", ":"), allow_nan=False                   │
│ ❱ 179 │   ).encode("utf-8")                                                                      │
│   180 │   content_length = str(len(body))                                                        │
│   181 │   content_type = "application/json"                                                      │
│   182 │   headers = {"Content-Length": content_length, "Content-Type": content_type}             │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ json = {                                                                                     │ │
│ │        │   'messages': [                                                                     │ │
│ │        │   │   {                                                                             │ │
│ │        │   │   │   'role': 'system',                                                         │ │
│ │        │   │   │   'content': 'You are ShellGPT\nYou are programming and system              │ │
│ │        administration assistant.\nYou ar'+272                                                │ │
│ │        │   │   },                                                                            │ │
│ │        │   │   {                                                                             │ │
│ │        │   │   │   'role': 'user',                                                           │ │
│ │        │   │   │   'content': 'diff --git a/third_party/Matcha-TTS                           │ │
│ │        b/third_party/Matcha-TTS\nindex dd9105b..1089'+17381                                  │ │
│ │        │   │   }                                                                             │ │
│ │        │   ],                                                                                │ │
│ │        │   'model': 'gpt-4o-mini',                                                           │ │
│ │        │   'stream': True,                                                                   │ │
│ │        │   'temperature': 0.0,                                                               │ │
│ │        │   'top_p': 1.0                                                                      │ │
│ │        }                                                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 1297-1298: surrogates not allowed

When does support Unicode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant