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

Allow non-ASCII characters in shortcut AppName. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pysteam/_shortcut_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def generate_shortcut_string(self,shortcut):
# supposed to end in x00 when there are more and x08 when there arent. Since
# I am not sure, I am going to leave the code in for now
def generate_keyvalue_pair(self,key,value,more=True):
return x01 + key + x00 + value + (x00 if more else x08)
return x01 + key + x00 + value.decode("raw_unicode_escape") + (x00 if more else x08)

def generate_tags_string(self,tags):
string = x00 + "tags" + x00
Expand All @@ -61,4 +61,4 @@ def generate_tag_array_string(self,tags):
for i in range(len(tags)):
tag = tags[i]
string += x01 + str(i) + x00 + str(tag) + x00
return string + x08
return string + x08
2 changes: 1 addition & 1 deletion pysteam/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def read_shortcuts(path):
def write_shortcuts(path, shortcuts):
vdf_contents = ShortcutGenerator().to_string(shortcuts)
with open(path, "w") as f:
f.write(vdf_contents)
f.write(vdf_contents.encode("raw_unicode_escape"))

# Helper functions which simply wrap the read/write shortcuts functions around
# the LocalUserContext object
Expand Down