Nuzair46 / BlockTheSpot-Mac

Spotify Ad blocker for MacOS
GNU General Public License v3.0
1.43k stars 89 forks source link

Fix: awk: towc: multibyte conversion failure on: '?! ' #83

Open genhack opened 2 months ago

genhack commented 2 months ago

Hello, installing spotify with brew and show this problem with awk.

`awk: towc: multibyte conversion failure on: '?! '

input record number 1, file /Applications/Spotify.app/Contents/Info.plist source line number 1


BlockTheSpot-Mac by @Nuzair46


Spotify version: BlockTheSpot-Mac version: 1.2.32.985.g3be2709c`

Instead with plutil retrieve the correct value as expected: ./install.sh
Spotify client version: 1.2.45.454


BlockTheSpot-Mac by @Nuzair46


Spotify version: 1.2.45.454 BlockTheSpot-Mac version: 1.2.32.985.g3be2709c

Creating backup... Extracting xpui... Applying BlockTheSpot patches... Removing ad-related content... Patching Binary... Removing premium-only features... Removing logging... Adding credits... Signing Spotify... BlockTheSpot finished patching!

Ali-Aljufairi commented 2 months ago

Thanks for solving the issue

bygalacos commented 1 month ago

The current script is using awk to parse values from a binary .plist file, resulting in the following error:

awk: towc: multibyte conversion failure on: '?! '
input record number 1, file /Applications/Spotify.app/Contents/Info.plist
source line number 1

This happens because the Info.plist file format is binary, and awk expects text input. The binary format contains characters that are not correctly interpreted by the tool, causing multibyte conversion errors.

jonxuxu commented 6 days ago

I fixed it by replacing this line in install.sh:

CLIENT_VERSION=$(awk '/CFBundleShortVersionString/{getline; print}' "${INSTALL_PATH}/Contents/Info.plist" | cut -d\> -f2-$

with this:

CLIENT_VERSION=$(plutil -extract CFBundleShortVersionString xml1 -o - "${INSTALL_PATH}/Contents/Info.plist" | sed -n 's/.*<string>\(.*\)<\/string>.*/\1/p')
MaEtUgR commented 4 days ago

I'd prefer this solution: https://github.com/Nuzair46/BlockTheSpot-Mac/pull/85 defaults read "/Applications/Spotify.app/Contents/Info.plist" CFBundleVersion gives you back the installed Spotify version without bash hackery 😉