Skip Menu |

This queue is for tickets about the Encode-IMAPUTF7 CPAN distribution.

Report information
The Basics
Id: 43494
Status: rejected
Priority: 0/
Queue: Encode-IMAPUTF7

People
Owner: Nobody in particular
Requestors: jaromir.obr [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: National chars are encoded incorrectly with module ver. 1.01
Date: Sat, 21 Feb 2009 15:40:21 +0100
To: bug-Encode-IMAPUTF7 [...] rt.cpan.org
From: Jaromir Obr <jaromir.obr [...] gmail.com>
configuration: Perl 5.8.9 (ActivePerl in WindowsXP) or 5.10.0 (Ubuntu 8.10) module Encode::IMAPUTF7, ver. 1.01 Steps to reproduce: print encode('IMAP-UTF-7', "š") # char "š" is a national char in Czech Expected result: &AWE- Actual result: &AMUAoQ- IMAPUTF7 ver 1.00 isn't affected I also tested creating of such IMAP folder with Outlook Express (Windows XP) and it produces the correct result too: &AWE- --------- Regards Jaromir Obr
I don't think this is a bug in Encode::IMAPUTF7 but an utf8 error on you side. All the below examples returns the expected '&AWE-' encode('IMAP-UTF-7', "\x{0161}"); # Unicode small letter s with caron encode("IMAP-UTF-7", decode("ISO-8859-2", "\xB9")); encode("IMAP-UTF-7", decode("ISO-8859-15", "\xA8")); To get you result I have to do something like encode('IMAP-UTF-7', "\xC5\xA1"); # Raw UTF8 small letter s with caron with an octet string consisting of the utf8 encoded letter. Upgrading to a real perl unicode-string makes encode work as expected: encode('IMAP-UTF-7', decode_utf8("\xC5\xA1")); I'm not really sure how the changes between 1.00 and 1.01 should explain why it worked otherwise before. I don't have easy access to a pre-5.10 perl where Encode::IMAPUTF7 worked, so I havn't tested the old version.
From: jaromir.obr [...] gmail.com
Yes, I agree it was bad example in my case. I was missing "use utf8", because the command contains char encoded in utf8. My original problem was in this command: encode('IMAP-UTF-7', encode("utf-8", $folder_name)) I used it for encoding of folder names get from MS Outlook via Win32::OLE. I'm using localised Outlook and it sometimes returns badly UTF-8 encoded folder names. Therefore I had to use workaround 'encode("utf-8", $string)' for such strings. Whole command worked well with IMAPUTF7 ver 1.00. Since 1.01 it returns another string. But I have found that with 1.01 I can use pure command 'encode('IMAP-UTF-7', $string)' and it works well as before. Therefore I think you can close this bug as NOTABUG - removing of my workaround fixes this problem and works well with IMAPUTF7 ver 1.01
I'm not sure why the changes from 1.00 to 1.01 shoudl have made Encode::IMAPUTF7 stricter regarding input. But as it doesn't looks like a bug I'm closing it.