[Rt-devel] Re: [rt-users] [PATCH] Russian description cause system error

Jesse Vincent jesse at bestpractical.com
Tue Sep 13 12:07:22 EDT 2005


Thanks. Applied

Ruslan Zakirov wrote:
> Attached, and also created Encode bug on rt.cpan.org.
>
> On 9/12/05, Jesse Vincent <jesse at bestpractical.com> wrote:
>
>>
>>
>>On Mon, Sep 12, 2005 at 11:25:20PM +0400, Ruslan Zakirov wrote:
>>
>>>Are changes description not enought?
>>>Or you want comment inlined into code?
>>
>>I want a patch with an inline comment, so that in a year, someone
>>doesn't try to optimize it away.
>>
>>
>>>On 9/12/05, Jesse Vincent <jesse at bestpractical.com> wrote:
>>>
>>>>Can I have a version of this patch with a two line comment about the
>>>>"why" of what you're doing?
>>>>
>>>>
>>>>On Wed, Sep 07, 2005 at 08:27:11PM +0400, Ruslan Zakirov wrote:
>>>>
>>>>>Ok, here is patch. Works in my test environment.
>>>>>
>>>>>Changes RT::Record::__Values method:
>>>>>* call Encode::decode_utf8 only if value has no UTF8 flag
>>>>>* call Encode::encode_utf8 if $args{decode_utf8} is false to drop UTF8
>>>>>flag, this is not necceserily to fix bug, but brings API to consistent
>>>>>state. I think all expect that this method returns values with UTF8
>>>>>flag on if decode_utf8 arg is true and with dropped flag in other
>>>>>case.
>>>>>
>>>>>Cronfy, please, check that it works for you in all places where you
>>>>>saw such error and send  results.
>>>>>
>>>>>On 9/7/05, Ruslan Zakirov <ruslan.zakirov at gmail.com> wrote:
>>>>>
>>>>>>Actually, queue is successfuly created, but when RT tries to show
>>>>>>queue info and calls __Value methods DBIx::SB takes values from cache
>>>>>>where all values already has UTF8 flag on, so decode_utf8 fails cuz it
>>>>>>requires octets input.
>>>>>>
>>>>>>We should just check UTF8 flag state before call decode_utf8, I'll
>>>>>>prepare patch and send it today.
>>>>>>
>>>>>>On 9/7/05, Ruslan Zakirov <ruslan.zakirov at gmail.com> wrote:
>>>>>>
>>>>>>>I can reproduce this, but didn't dig deep why it happens.
>>>>>>>
>>>>>>>On 9/7/05, cronfy - ipnet <cronfy at ipnet.ru> wrote:
>>>>>>>
>>>>>>>>Good day, everyone!
>>>>>>>>
>>>>>>>>Nice to meet you.
>>>>>>>>I have just installed RT-3.4.4 with mod_perl/1.29 and Apache/1.3.31.
>>>>>>>>It works fine while it is english, but when I try to set russian
>>>>>>>>description for a new queue or group, I get System Error like one
>>>>>>>>I placed here: http://cronfy.spb.ru/error.htm,  but group or queue
>>>>>>>>is created though. Creating a group or a queue with russian name
>>>>>>>>and english description works OK.
>>>>>>>>There was same problem with setting russian descriptions for
>>>>>>>>CustomsFields values when I used RT-3.4.3, but this problem has gone
>>>>>>>>after I upgraded RT.
>>>>>>>>
>>>>>>>>What can I do to fix this?..
>>>>>>>>
>>>>>>>>Thank You.
>>>>>>>>
>>>>>>>>--
>>>>>>>> cronfy                          mailto:cronfy at ipnet.ru
>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>>>>>>>
>>>>>>>>Be sure to check out the RT Wiki at http://wiki.bestpractical.com
>>>>>>>>
>>>>>>>>Buy your copy of our new book, RT Essentials, today!
>>>>>>>>
>>>>>>>>Download a free sample chapter from http://rtbook.bestpractical.com
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>--
>>>>>>>Best regards, Ruslan.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>--
>>>>>>Best regards, Ruslan.
>>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>Best regards, Ruslan.
>>>>
>>>>>=== lib/RT/Record.pm
>>>>>==================================================================
>>>>>--- lib/RT/Record.pm  (revision 790)
>>>>>+++ lib/RT/Record.pm  (local)
>>>>>@@ -670,7 +670,11 @@
>>>>>
>>>>>     return('') if ( !defined($value) || $value eq '');
>>>>>
>>>>>-    return Encode::decode_utf8($value) || $value if $args{'decode_utf8'};
>>>>>+    if( $args{'decode_utf8'} ) {
>>>>>+        return Encode::decode_utf8($value) unless Encode::is_utf8($value);
>>>>>+    } else {
>>>>>+        return Encode::encode_utf8($value) if Encode::is_utf8($value);
>>>>>+    }
>>>>>     return $value;
>>>>> }
>>>>>
>>>>
>>>>>_______________________________________________
>>>>>Rt-devel mailing list
>>>>>Rt-devel at lists.bestpractical.com
>>>>>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>>>>
>>>>
>>>>--
>>>>
>>>
>>>
>>>--
>>>Best regards, Ruslan.
>>>
>>
>>--
>>
>
>
>
>
> ------------------------------------------------------------------------
>
> === lib/RT/Record.pm
> ==================================================================
> --- lib/RT/Record.pm	(revision 793)
> +++ lib/RT/Record.pm	(local)
> @@ -670,7 +670,14 @@
>
>      return('') if ( !defined($value) || $value eq '');
>
> -    return Encode::decode_utf8($value) || $value if $args{'decode_utf8'};
> +    if( $args{'decode_utf8'} ) {
> +    	# XXX: is_utf8 check should be here unless Encode bug would be fixed
> +        # see http://rt.cpan.org/NoAuth/Bug.html?id=14559
> +        return Encode::decode_utf8($value) unless Encode::is_utf8($value);
> +    } else {
> +        # check is_utf8 here just to be shure
> +        return Encode::encode_utf8($value) if Encode::is_utf8($value);
> +    }
>      return $value;
>  }
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20050913/4dd5b06b/signature.pgp


More information about the Rt-devel mailing list