Your test was correct. Now we know that the 'replace' option replaces characters with a question mark.

Eero: Feel free to proceed as you see fit (or ask Alex - he usually has a helpful perspective on issues like this).


----- Original Message ----
From: Arturas Sleinius <>
To: Eero Tamminen <>
Cc: Brian Matherly <>;; Alex Roitman <>
Sent: Friday, June 30, 2006 11:24:28 AM
Subject: Re: [Gramps-devel] Catching UnicodeEncodeError exception from GraphViz report


I'm not sure if this was required from me, but I did following:
1. Updated  gramps from svn to 6975
2. Compiled progrma, exported from old version data, imported them to new version.
3. Ran  relationship diagram  changing only one parameter .. (require latin1 output).
With one option  (unchecked) mine name is Artūras Šleinius (correct one)
While checked it shows Art?ras ?leinius   (all non latin-1 characters are changed by character "?")

Its up to you to  decide is it ok or not.

If mine tests are wrong give at  least some directions  how I should test.


On 6/29/06, Eero Tamminen <> wrote:

On Saturday 24 June 2006 22:01, Brian Matherly wrote:
> >---------------------
> >            try:
> >                dotfile.write(buffer.encode('iso-8859-1'))
> >            except UnicodeEncodeError:
> >                raise Errors.ReportError (), (_("Your data contains
> >characters that cannot be converted to latin-1. Unselect latin-1 option
> > and try again."),)
> >---------------------
> >Instead of just:
> >                 dotfile.write(buffer.encode('iso-8859-1'))
> The way I had fixed this previously in the 2.1 branch was like this:
>         if self.latin:
>             self.f.write(the_buffer.encode('iso-8859-1', 'replace'))
>         else:
>             self.f.write(the_buffer)
> The "replace" option tells the encode function to replace characters that
> can not be represented in the given encoding. I don't actually know what
> it replaces them with. But at least it doesn't throw an exception.

Interesting, I didn't know about that.

> This problem doesn't affect me since I don't use it, so I have no
> preference between my way and yours. If you change it, I certainly won't
> mind.

Producing something sounds nice, but it would also be nice to inform user
about the problem with the selected option in case it was selected on
purpose and/or the output wasn't what was expected.

Arturas, could you test the 2.1.x version with Brian's fix using
the "latin-1" option and tell whether the results of "replacing
characters" are acceptable?

If they are acceptable, I think Brian's fix is OK, otherwise it would be
better to tell user what's the problem and how to fix it.

        - Eero

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Gramps-devel mailing list