Re: [slim] Problem with character-sets on the CLI
jimwillsher wrote: Okay, sorted it. For the C++ people (not this awful Perl stuff) the solution is: You shouldn't be using slimserver then ;) Regards, Peter ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Don't get me wrong, I think SlimServer is excellent. I have an SB3, having previously had an SB2 and an SB1. But Perl is almost exclusively the realm of *nix platforms; very very little perl stuff is every written for Windows systems. Windows development is typically done in C/C++, which is what I'm using. But fortunately there are standards, and in this case the standard is UTF-8. As such, I can now successfully interface my C+ code with the output form the CLI. Jim -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
jimwillsher wrote: Don't get me wrong, I think SlimServer is excellent. I have an SB3, having previously had an SB2 and an SB1. But Perl is almost exclusively the realm of *nix platforms; very very little perl stuff is every written for Windows systems. Windows development is typically done in C/C++, which is what I'm using. VB is still quite popular as I understand. I've actually done some Windows stuff in Perl, it wasn't so bad really, but I'd like to see a good C++ slimserver interface! But fortunately there are standards, and in this case the standard is UTF-8. As such, I can now successfully interface my C+ code with the output form the CLI. Make sure you check it works well in Chinese ;) Regards, Peter (charactersets always give me a head ache) ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Hmmm...chinese, yes. I have plenty of gaelic songs, but not chinese. Anyway, new version of SqueezeMSN about to be uploaded (http://www.jimwillsher.co.uk/Site/Software/SqueezeMSN.php), now that I've fixed the Unicode issue :-) Jim -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
jimwillsher wrote: Hmmm...chinese, yes. I have plenty of gaelic songs, but not chinese. Anyway, new version of SqueezeMSN about to be uploaded (http://www.jimwillsher.co.uk/Site/Software/SqueezeMSN.php), now that I've fixed the Unicode issue :-) Great. Unfortunately I use GAIM to connect to MSN so it' not for me ;) Perhaps you should get together with this guy: http://software.johnroark.net/ Regards, Peter ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
jimwillsher wrote: Hmmm...chinese, yes. I have plenty of gaelic songs, but not chinese. Anyway, new version of SqueezeMSN about to be uploaded (http://www.jimwillsher.co.uk/Site/Software/SqueezeMSN.php), now that I've fixed the Unicode issue :-) If you really want to stress test your unicode implementation, try Turkish. There's essentially a bug in the unicode spec, where the following Java code will fail if run in a Turkish locale: assert(SIMPLE.toLowerCase().contains(i)); For a more topical example: if(filename.toLowerCase().endsWith(aiff)) { // ... handle aiff audio file } - Marc ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
title Tráthnóna Beag Aréir I ended up adding charset:iso-8859-1 to the CLI requests. Possibly a 7-bit/8-bit issue, or a UTF-8 issue? I'm sorry, I'm no expert in that area. I took the pragmatic approach described above as it seemed to do what I expected... -- Michael - http://www.herger.net/SlimCD - your SlimServer on a CD http://www.herger.net/slim - AlbumReview, Biography, MusicInfoSCR ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Hmm...unfortunately the title ? and artists ? etc. parameters do not seem to accept the charset argument. Unless I'm doing it wrong? Jim -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
jimwillsher;182848 Wrote: 7. Tráthnóna Beag Aréir 37 2E 20 54 72 E1 74 68 6E F3 6E 61 20 42 65 61 67 20 41 72 E9 72 The interesting charaters (for me) here are: á E1 ó F3 é E9 á %C3%A1 ó %C3%B3 é %C3%A9 See http://en.wikipedia.org/wiki/Utf8 UTF-8 requires at least 16 bits to represent a character with an ordinal value greater than 0x7F. The CLI appears to be URI-escaping individual bytes of a UTF-8 encoded sequence. 0xE1 == binary 00011-11 (dashes for readability) In UTF-8, that would be 110-00011 10-11 Binary 110-00011 == 0xC3 Binary 10-11 == 0xA1 -- peterw peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Hmmm...interesting. I can see the logic. But how on earth would I convert it BACK to a sensible value - in any language!? I'm not sure it's a practical conversion. e.g. how does C3A1 get to become E1? Confused -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Code: $ perl -e 'use CGI; $in = %C3%A1; $out = CGI::unescape($in); \ utf8::decode($out); print \n\$in\ decodes to \$out\\n;' %C3%A1 decodes to á -- peterw peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Hmmmperl. Not really a solution. But thanks anyway. -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss
Re: [slim] Problem with character-sets on the CLI
Okay, sorted it. For the C++ people (not this awful Perl stuff) the solution is: Code: CString CSqueezeboxStatus::FromUTF8(LPBYTE pUTF8, int nSize) { #define MAX_CHAR 1 WCHAR wszResult[MAX_CHAR+1]; DWORD dwResult = MAX_CHAR; CString cResult; int iRes = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pUTF8, nSize, wszResult, dwResult); if (iRes == 0) { DWORD dwErr = GetLastError(); printf(MultiByteToWideChar() failed - %d\n, dwErr); } else { wszResult[iRes] = _T('\x00'); cResult = wszResult; } return cResult; } Many thanks to the contributors to this thread who pointed me in the right direction. This problem has nagged me for months! Jim -- jimwillsher jimwillsher's Profile: http://forums.slimdevices.com/member.php?userid=410 View this thread: http://forums.slimdevices.com/showthread.php?t=33029 ___ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/lists/listinfo/discuss