[REL] [ALL] Update Script for Script Updates ! ;)

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
yeti
Posts: 60
Joined: 2003-09-14 15:50:05

Re: [REL] [ALL] Update Script for Script Updates ! ;)

Post by yeti »

See also viewtopic.php?f=12&t=7031

I've written the function UTF8ToAnsi() for UPDATE_SCRIPS.ifs without a comment what it is for. Here it is:

// This function fixes incorrectly UTF-8 encoded code pages (like windows-1250,
// windows-1252 and others).
// Problem: if a script with a code page other than Latin-1 and with chars >0x7F
// was loaded with GetPage() and decoded with UTF8Decode(), the chars are broken
// and the script unuseable (only AMC >= 4.2.2).
// Reason: the chars >127 (0x7F) were simply interpreted as Latin-1 and mapped
// 1:1 into Unicode / encoded as 2-Byte UTF-8.
// E.g. windows-1250 char 0x9C (small s with Acute) has to be mapped usually to
// Unicode char 0x015B (UTF-8 0xC59B), but were incorrectly mapped to Unicode
// 0x009C and then falsely encoded to UTF-8 0xC29C (Latin-1 0x9C).
// Because Latin-1 0x9C is a control char and can't be displayed, UTF8Decode()
// replaces the char with a ? (btw it's not UTF8Decode()s fault).
// Dirty solution: UTF8ToAnsi() replaces all 2-Byte UTF-8 chars (max 8 of
// the 11 bits) with the decoded ones without interpreting/mapping them
// (UTF-8 0xC29C -> 0x9C). This fixes the problem and the script is useable.

This would not be necessary, if AMC had a function like GetPicture(), but for other Files.
E.g. GetFile(Address, Filename). But this can be a security problem (download trojans etc.) :)
Better a function GetScript(Scriptname, Filename) in which Scriptname will be internally prefixed with "https://update.antp.be/amc/scripts/".
Then GetScript('archive/Filmweb (PL).ifs', 'Filmweb (PL).ifs') simply downloads it from archive without code page/charset problems.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: [REL] [ALL] Update Script for Script Updates ! ;)

Post by antp »

The script update should be embedded in AMC itself; that script exists just because I've always been lazy to add the update system :D
yeti
Posts: 60
Joined: 2003-09-14 15:50:05

Re: [REL] [ALL] Update Script for Script Updates ! ;)

Post by yeti »

Yes! That is much better (I wanted to hear that).
Let's do it :clapping:
athe
Posts: 170
Joined: 2013-06-01 20:26:24
Location: Poland

Re: [REL] [ALL] Update Script for Script Updates ! ;)

Post by athe »

Many thanks, @Yeti for solving problems with Polish characters for filmweb (PL)
Post Reply