Skip to content

Commit

Permalink
Fixed a case when template variable is WindowsPath (#2707)
Browse files Browse the repository at this point in the history
Co-authored-by: NtWriteCode <NtWriteCode@users.noreply.github.com>
  • Loading branch information
NtWriteCode and NtWriteCode committed Apr 23, 2024
1 parent 001a327 commit 4a13deb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/virtualenv/activation/via_template.py
Expand Up @@ -48,7 +48,7 @@ def _generate(self, replacements, templates, to_folder, creator):
if dest.exists():
dest.unlink()
# Powershell assumes Windows 1252 encoding when reading files without BOM
encoding = "utf-8-sig" if template.endswith(".ps1") else "utf-8"
encoding = "utf-8-sig" if str(template).endswith(".ps1") else "utf-8"
# use write_bytes to avoid platform specific line normalization (\n -> \r\n)
dest.write_bytes(text.encode(encoding))
generated.append(dest)
Expand Down

0 comments on commit 4a13deb

Please sign in to comment.