Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f05f81

Browse filesBrowse files
authored
Use utf-8 for reading files (#1200)
1 parent 618e579 commit 3f05f81
Copy full SHA for 3f05f81

File tree

Expand file treeCollapse file tree

5 files changed

+6
-5
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+6
-5
lines changed

‎docs/source/about/changelog.rst

Copy file name to clipboardExpand all lines: docs/source/about/changelog.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Unreleased
2222

2323
- :pull:`1118` - `module_from_template` is broken with a recent release of `requests`
2424
- :pull:`1131` - `module_from_template` did not work when using Flask backend
25+
- :pull:`1200` - Fixed `UnicodeDecodeError` when using `reactpy.web.export`
2526

2627
**Added**
2728

‎src/py/reactpy/reactpy/_console/rewrite_camel_case_props.py

Copy file name to clipboardExpand all lines: src/py/reactpy/reactpy/_console/rewrite_camel_case_props.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def rewrite_camel_case_props(paths: list[str]) -> None:
2929

3030
for p in map(Path, paths):
3131
for f in [p] if p.is_file() else p.rglob("*.py"):
32-
result = generate_rewrite(file=f, source=f.read_text())
32+
result = generate_rewrite(file=f, source=f.read_text(encoding="utf-8"))
3333
if result is not None:
3434
f.write_text(result)
3535

‎src/py/reactpy/reactpy/_console/rewrite_keys.py

Copy file name to clipboardExpand all lines: src/py/reactpy/reactpy/_console/rewrite_keys.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def rewrite_keys(paths: list[str]) -> None:
5151

5252
for p in map(Path, paths):
5353
for f in [p] if p.is_file() else p.rglob("*.py"):
54-
result = generate_rewrite(file=f, source=f.read_text())
54+
result = generate_rewrite(file=f, source=f.read_text(encoding="utf-8"))
5555
if result is not None:
5656
f.write_text(result)
5757

‎src/py/reactpy/reactpy/web/module.py

Copy file name to clipboardExpand all lines: src/py/reactpy/reactpy/web/module.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def module_from_template(
145145
raise ValueError(msg)
146146

147147
variables = {"PACKAGE": package, "CDN": cdn, "VERSION": template_version}
148-
content = Template(template_file.read_text()).substitute(variables)
148+
content = Template(template_file.read_text(encoding="utf-8")).substitute(variables)
149149

150150
return module_from_string(
151151
_FROM_TEMPLATE_DIR + "/" + package_name,
@@ -270,7 +270,7 @@ def module_from_string(
270270

271271
target_file = _web_module_path(name)
272272

273-
if target_file.exists() and target_file.read_text() != content:
273+
if target_file.exists() and target_file.read_text(encoding="utf-8") != content:
274274
logger.info(
275275
f"Existing web module {name!r} will "
276276
f"be replaced with {target_file.resolve()}"

‎src/py/reactpy/reactpy/web/utils.py

Copy file name to clipboardExpand all lines: src/py/reactpy/reactpy/web/utils.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def resolve_module_exports_from_file(
2929
return set()
3030

3131
export_names, references = resolve_module_exports_from_source(
32-
file.read_text(), exclude_default=is_re_export
32+
file.read_text(encoding="utf-8"), exclude_default=is_re_export
3333
)
3434

3535
for ref in references:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.