You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "Marcus Christie (Jira)" <ji...@apache.org> on 2022/05/13 22:01:00 UTC

[jira] [Commented] (AIRAVATA-3618) UnicodeDecodeError when editing a text file

    [ https://issues.apache.org/jira/browse/AIRAVATA-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536908#comment-17536908 ] 

Marcus Christie commented on AIRAVATA-3618:
-------------------------------------------

Error occurs on airavata_django_portal_sdk/user_storage/backends/django_filesystem_provider.py, line 102, in update

In the error messages, the file being written is opened with ANSI_X3.4-1968 encoding

{code}
<_io.TextIOWrapper name='/var/www/portals/gateway-user-data/django-seagrid/machrist@iu.edu/test.txt' mode='w' encoding='ANSI_X3.4-1968'>
{code}

This is basically ASCII. So I think the fix is to open the file in UTF-8.



> UnicodeDecodeError when editing a text file
> -------------------------------------------
>
>                 Key: AIRAVATA-3618
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-3618
>             Project: Airavata
>          Issue Type: Bug
>          Components: Django Portal
>            Reporter: Marcus Christie
>            Assignee: Marcus Christie
>            Priority: Major
>
> UnicodeEncodeError occurs when updating a data product with text that includes unicode characters: https://github.com/apache/airavata-django-portal/blob/develop/django_airavata/apps/api/views.py#L826-L829
> h3. Steps to reproduce
> 1. Upload a text file into user storage
> 2. Click on the file.
> 3. In the editor, add the following characters to the file.
> {code}
> izaciĆ³n aci
> {code}
> 4. Save file
> h3. Expected results
> File saves successfully
> h3. Actual results
> Error message *'ascii' codec can't encode character '\\xf3' in position 5: ordinal not in range(128)* and file fails to save.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)