mediadc icon indicating copy to clipboard operation
mediadc copied to clipboard

`'ascii' codec can't encode characters in position 49-50: ordinal not in range(128)`

Open emptinessboy opened this issue 3 years ago • 9 comments

Describe the bug Exception(UnicodeEncodeError): 'ascii' codec can't encode characters in position 49-50: ordinal not in range(128)

To Reproduce When I use a folder contain Chinese characters.

Screenshots

Desktop (please complete the following information):

{
  "nextcloud-version": "23.0.4.1",
  "webserver": "nginx/1.21.4",
  "database": {
    "type": "mysql",
    "version": "8.0.20",
    "size": "121700352"
  },
  "php-version": "8.0.7",
  "php-interpreter": "php",
  "python-version": "3.6.8",
  "python-interpretter-setting": "/usr/bin/python3",
  "os": "Linux",
  "os-release": "5.17.4-1.el7.elrepo.x86_64",
  "machine-type": "x86_64",
  "mediadc-version": "0.1.9",
  "mediadc-settings": {
    "remote_filesize_limit": "536870912",
    "installed": {
      "status": true,
      "installed_list": {
        "boost": {
          "hexhamming": {
            "package": "hexhamming",
            "version": "2.2.3",
            "location": "global"
          }
        },
        "optional": {
          "nacl": {
            "package": "pynacl",
            "version": "1.5.0",
            "location": "global"
          },
          "pywt": {
            "package": "pywavelets",
            "version": "1.1.1",
            "location": "global"
          },
          "scipy": {
            "package": "scipy",
            "version": "1.5.4",
            "location": "global"
          },
          "pillow_heif": {
            "package": "pillow_heif",
            "version": "0.2.2",
            "location": "global"
          },
          "cryptography": {
            "package": "cryptography",
            "version": "37.0.0",
            "location": "global"
          }
        },
        "required": {
          "PIL": {
            "package": "pillow",
            "version": "8.4.0",
            "location": "global"
          },
          "numpy": {
            "package": "numpy",
            "version": "1.19.5",
            "location": "global"
          }
        }
      },
      "video_required": [],
      "not_installed_list": {
        "boost": [],
        "optional": [],
        "required": []
      },
      "available_algorithms": [
        "average",
        "dhash",
        "phash",
        "whash"
      ]
    }
  }
}

Additional context locate on my system

[root@xf ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

I also tried export LC_ALL="en_US.utf8" , but not work.

emptinessboy avatar Apr 28 '22 08:04 emptinessboy

@emptinessboy Can you run SHOW VARIABLES LIKE 'character\_set\_%'; request in database and put output here?

bigcat88 avatar Apr 28 '22 12:04 bigcat88

I have run it in phpMyadmin, the result is like below.

Variable_name Value
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8

LXjqgA.png

emptinessboy avatar Apr 28 '22 13:04 emptinessboy

Last thing to know, can you execute in console: python -c 'import sys; print(sys.getdefaultencoding())' code to see maybe python for some reason working in non utf-8 mode(but I doubt this, it look like a bug, will look at it near time).

bigcat88 avatar Apr 29 '22 10:04 bigcat88

Ok4PXj.png

# python3 -c 'import sys; print(sys.getdefaultencoding())'
utf-8

emptinessboy avatar May 03 '22 08:05 emptinessboy

It seems that python is running in utf-8 mode(I use python3 in /user/bin/python3), or maybe the .py program doesn't regster in utf8 mode curroctly?

emptinessboy avatar May 03 '22 08:05 emptinessboy

utf-8 is the default python3 mode. problem is that i created a folder with china, ukrainian and english symbols and it was processed correctly, so i can't find how to get this bug to debug... i am thinking of this, maybe will find some idea how to find this bug...

bigcat88 avatar May 03 '22 10:05 bigcat88

It seems that the folder contain Chinese works ok, but file name contain Chinese get wrong.

emptinessboy avatar May 09 '22 16:05 emptinessboy

Soon will be a newer version posted, maybe there will be no this bug(but maybe will be still) If new version will still not work, is there any chances to test-run it on a newer version of python? Like 3.7-3.8 ?

bigcat88 avatar May 09 '22 20:05 bigcat88

Soon will be a newer version posted, maybe there will be no this bug(but maybe will be still) If new version will still not work, is there any chances to test-run it on a newer version of python? Like 3.7-3.8 ?

Maybe not so soon as I expected, my part is done, but PHP part that are maintained by Andrey are still in progress. Just waiting...

bigcat88 avatar May 21 '22 11:05 bigcat88

we need information on this issue with version 0.3.1, whether it exists or not

bigcat88 avatar Dec 20 '22 07:12 bigcat88

Closing as stale and resolved.

If have any additions feel free to write here or open issue.

andrey18106 avatar Jan 31 '23 20:01 andrey18106