homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
300 stars 28 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range (128) #133

Closed nilsbyte closed 3 years ago

nilsbyte commented 6 years ago

OSX 10.11.6 Python 2.7.10 / 3.6.5

Processing https://poedit.net/updates_v2/osx/appcast ...
Input path looks like a Sparkle feed.
    Sparkle feed is: https://poedit.net/updates_v2/osx/appcast
Getting information from Sparkle feed...
    The Sparkle feed provides a version number
    The latest version is 5278
    Download URL is: https://download.poedit.net/Poedit-2.0.7.sparkle.tar.xz
Downloading file for further inspection...
    Downloaded to /Users/admin/Library/Caches/Recipe Robot/2018-05-04_15-46-14_830343/Poedit-2.0.7.sparkle.tar.xz
Determining download format...
Opening downloaded file...
    Successfully unarchived tgz
Validating app...
    App seems valid
Getting app name...
    App name is: Poedit
Getting bundle identifier...
    Bundle identifier is: net.poedit.Poedit
Looking for version key...
    Version key is: CFBundleShortVersionString (2.0.7)
Looking for app icon...
    App icon is: /Users/admin/Library/Caches/Recipe Robot/2018-05-04_15-46-14_830343/unpacked/Poedit.app/Contents/Resources/Poedit
Getting app description from MacUpdate...
Gathering code signature information...
    Code signature verification requirements recorded
    3 authority names recorded
    Developer: Václav Slavík
[ERROR] Recipe Robot exploded with unexpected error: 
Traceback (most recent call last):
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe-robot", line 95, in main
    process_input_path(facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 131, in process_input_path
    facts = inspect_func(input_path, args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 1730, in inspect_sparkle_feed_url
    facts = inspect_download_url(latest_url, args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 1029, in inspect_download_url
    facts = inspect_archive(os.path.join(CACHE_DIR, filename), args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 504, in inspect_archive
    facts = inspect_app(os.path.join(CACHE_DIR, "unpacked", this_file), args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 399, in inspect_app
    facts["developer"] = developer
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/facts.py", line 81, in __setitem__
    val = NotifyingString(self.default_suffix, val)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/facts.py", line 143, in __new__
    instance = super(NotifyingString, cls).__new__(cls, text.encode("utf-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

[ERROR] 
                                    _[]_
                                    [xx]
                                   q-||-p
                                     ||
                                   _/  \_
homebysix commented 6 years ago

I think there are actually two problems going on here:

The first issue can be solved by properly handling unicode all the way through Recipe Robot, which I admit I'm not as knowledgeable about as I should be. Seems to me that developers should be encoded as unicode by default, except when they need to be strings (POSIX paths?). I'll look into this.

The second issue is trickier. Even if Recipe Robot knows that .xz is a compressed archive, it won't do much good in this situation because the Unarchiver processor doesn't. Meaning: you can't use AutoPkg to process this app's Sparkle feed without writing a custom processor.

(If somebody wanted to add .xz format support to Unarchiver, I suspect that this code would be a good start.)