[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grinder-use
Subject:    Re: [Grinder-use] Jython 2.5 encoding error
From:       Ernesto Domato <edomat () gmail ! com>
Date:       2010-05-11 16:33:39
Message-ID: AANLkTimqyGlrIqNI-p2MmzZvtviwBBLhIyhbecQurmuG () mail ! gmail ! com
[Download RAW message or body]

On Mon, May 10, 2010 at 22:42,  <anil_jacob@comcast.net> wrote:
>
> I am using Jython 2.5 with Grinder 3.4. When I try to print or read the
> response which is result.text. I get this error -  Aborted run due to Jython
> exception: <type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't
> encode characters in position 10814-10815: ordinal not in range(128)
> [calling TestRunner]
>
> When I switched to Jython2.1 the same response was readable without any
> error.
>
> I tried using the connectionDefaults.setUseContentEncoding(1) didn't work
> with Jython2.5.
>
> Any ideas?
>

Hi, I have the same problem
(http://permalink.gmane.org/gmane.comp.java.grinder.user/7135) and I
also send a mail to the Jython mailing list and the response was this:

-----

The problem is that the script is trying to encode unicode characters
that are outside the ascii range into ascii. ascii is the default
encoding for python. UnicodeEncodeError is a very common Python
exception. This problem is not Jython related, its more of an example
of a misunderstanding of unicode encoding/decoding in Python.

Im going to take a stab and try help you out, even though I dont know
the actual encodings in use here. Try this:

1. import codecs at the top of the script

2. Change the code in writeToFile to include:
f = codecs.open(filename, 'w', encoding='utf-8')
f.write(text)
f.close()

-----

So, you can try this solution at least sending the content of
result.text to a file.

Hope this help.
Ernesto

------------------------------------------------------------------------------

_______________________________________________
grinder-use mailing list
grinder-use@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/grinder-use

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic