PDA

View Full Version : Patch: encode plugin's strings



mherger
2005-02-23, 00:29
The attached patch should correctly encode strings contained in the <DATA>
part of plugins (like ShoutcastBrowser & co.)


Index: /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm
================================================== =================
--- /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm (revision 2163)
+++ /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm (working copy)
@@ -147,6 +147,7 @@
my $strings = eval { &{$fullname . "::strings"}() };

if (!$@ && $strings) {
+ $strings = pack "U0C*", unpack "C*", $strings;
Slim::Utils::Strings::addStrings(\$strings);
}



--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

Dan Sully
2005-02-23, 00:32
* Michael Herger shaped the electrons to say...

>The attached patch should correctly encode strings contained in the <DATA>
>part of plugins (like ShoutcastBrowser & co.)
>
>
>Index: /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm
>================================================== =================
>--- /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm (revision 2163)
>+++ /home/mh/eclipse/SVN/Slim/Buttons/Plugins.pm (working copy)
>@@ -147,6 +147,7 @@
> my $strings = eval { &{$fullname . "::strings"}() };
>
> if (!$@ && $strings) {
>+ $strings = pack "U0C*", unpack "C*", $strings;
> Slim::Utils::Strings::addStrings(\$strings);
> }

Michael - does this need to be wrapped so it doesn't get executed on perl 5.6?

-D
--
<fuz> deregulation will lead to greater competition, consumer choice, and lower prices.
my name is elmer fudd. I own a mansion and a yacht.

mherger
2005-02-23, 01:18
On Tue, 22 Feb 2005 23:32:22 -0800, Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

[..]
>> if (!$@ && $strings) {
>> + $strings = pack "U0C*", unpack "C*", $strings;
>> Slim::Utils::Strings::addStrings(\$strings);
>> }
>
> Michael - does this need to be wrapped so it doesn't get executed on
> perl 5.6?

How should I know? :-) I simply copied/pasted this from
http://www.ahinea.com/en/tech/perl-unicode-struggle.html.

Under "Let perl know you are a grown-up" it says: "Here is a way to make
it work in both perl versions (5.6.1 and 5.8.0, at least)". I gave it a
try using perl 5.6.1 (SME/Redhat) and 5.8.5 (Mandrake) and it seems to
work correctly.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

Dan Sully
2005-02-23, 01:31
* Michael Herger shaped the electrons to say...

>>Michael - does this need to be wrapped so it doesn't get executed on
>>perl 5.6?
>
>How should I know? :-) I simply copied/pasted this from
>http://www.ahinea.com/en/tech/perl-unicode-struggle.html.
>
>Under "Let perl know you are a grown-up" it says: "Here is a way to make
>it work in both perl versions (5.6.1 and 5.8.0, at least)". I gave it a
>try using perl 5.6.1 (SME/Redhat) and 5.8.5 (Mandrake) and it seems to
>work correctly.

Heh, ok. Applied.

-D
--
I'm really looking forward to this hangover.