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

ValueError: strings can't contains control characters; use bytes instead #9

Open
earhax opened this issue Mar 19, 2023 · 0 comments
Open

Comments

@earhax
Copy link

earhax commented Mar 19, 2023

Seeing this ValueError when opening the .GlobalPreferences.plist file (or any copy of it) on macOS (10.12.6 Sierra, to be precise). Conversion to XML formatting fails. Here's the complete log from the console in Sublime Text (Stable, build 4143).

unable to auto detect encoding for ~/Documents/.GlobalPreferences.plist, using fallback encoding Western (Windows 1252)
command: binary_plist_toggle
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1494, in run_
    return self.run(edit)
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/BinaryPlist.py", line 107, in run
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/BinaryPlist.py", line 83, in to_xml_plist
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 1035, in dumps
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 1028, in dump
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 464, in write
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 487, in write_value
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 534, in write_dict
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 487, in write_value
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 534, in write_dict
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 469, in write_value
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 433, in simple_element
  File "/Users/MM/Library/Application Support/Sublime Text 3/Installed Packages/BinaryPlist.sublime-package/plistlib/plistlib.py", line 300, in _escape
ValueError: strings can't contains control characters; use bytes instead
command: exec {"update_annotations_only": true}

Tried uninstall/reinstall of BInaryPlist package, and a different version (old backup) of the (dot)GlobalPreferences.plist file with the same result.

Oddly enough, if the attached file is renamed with the literal . in place of (dot) at the start of the filename, after opening the file (opens in binary plist format) I can use the keyboard shortcut for the Plist Binary plugin (https://github.com/relikd/Plist-Binary_Sublime), which will toggle the file view to XML (overwrites the file, though), and toggle it back to binary. However, doing so causes some data loss (also goes from 67KB to 253KB, and 120KB when converted back to binary again) when diffing with the original file. Similarly, I noticed when testing with the same file copied to .GlobalPreferences copy.plist, the both the Binary Plist plugin and the other Plist Binary shortcut also failed to convert/display the file in XML format, the same as when the file is named (dot)GlobalPreferences.plist.

Tried attaching sample plist file (with personal info redacted) for troubleshooting assistance, but for some reason my browser won't let me drag & drop the file here, or perform other formatting using the formatting tools above the message composition field. Please respond with an email or info on where/how to upload the file if it might help resolve this issue.

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