mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Fix an encoding issue in gradio/components/code.py (#8077)
* Fix an enconding issue in gradio/components/code.py Changes Made: Modified the postprocess function in gradio/components/code.py to handle file encoding properly. Added encoding="utf-8" parameter to the open function when reading code files. I hardcoded UTF-8 because I couldn't figure out how to specify the encoding, similar to the fix in gradio-app#8075. My issue is gradio-app#8076 * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
2afca65419
commit
d7461aab51
5
.changeset/easy-sites-lie.md
Normal file
5
.changeset/easy-sites-lie.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix an encoding issue in gradio/components/code.py
|
@ -151,7 +151,7 @@ class Code(Component):
|
||||
if value is None:
|
||||
return None
|
||||
elif isinstance(value, tuple):
|
||||
with open(value[0]) as file_data:
|
||||
with open(value[0], encoding="utf-8") as file_data:
|
||||
return file_data.read()
|
||||
else:
|
||||
return value.strip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user