[sword-devel] python3 , StrongsGreek and unicodeDecodeError

David Haslam dfhdfh at protonmail.com
Sun Jun 16 15:26:20 EDT 2019


Does this issue also affect dictionary module StrongsRealGreek in the Xiphos repo?

Or was that encoded correctly as UTF-8 ?

David

Sent from ProtonMail Mobile

On Sun, Jun 16, 2019 at 20:14, Troy A. Griffitts <scribe at crosswire.org> wrote:

> Hi Pierre,
>
> I had similar problems with our Java bindings.  Java was unforgiving
> with invalid UTF-8 characters, as well.  Ultimately we should fix any
> invalid UTF-8 characters in our modules and encode them correctly, but
> my solution was, in the bindings code, to call:
>
> assureValidUTF8()
>
> before returning results to Java.  This call is available from SWORD's
> utilstr.h
>
> Hope this helps a bit,
>
> Troy
>
> On 6/16/19 12:02 PM, pierre amadio wrote:
>> Hi there !
>>
>> Playing with the python3 Sword module I hit a problem that I did not
>> have with python2 when dealing with Strongs definition such as G1140
>> (daimonion). It looks like the 'æ' character is causing problem.
>>
>> This example works with python2, but generate an error when ran wiht python3:
>>
>> ##########
>> import Sword
>> library = Sword.SWMgr()
>> target=library.getModule("StrongsGreek")
>> vk=Sword.SWKey("1140")
>> target.setKey(vk)
>> strongEntry=target.renderText().getRawData()
>> ###########
>>
>> File "/usr/local/sword/python3/lib64/python3.4/site-packages/Sword.py",
>> line 128, in getRawData
>> def getRawData(self): return _Sword.SWBuf_getRawData(self)
>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position
>> 73: invalid continuation byte
>>
>> Anyone knows how to be able to catch the content of this entry in a
>> python variable ?
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20190616/2ec83322/attachment.html>


More information about the sword-devel mailing list