[PYTHON] The story that Japanese output was confused with Django

image.png

For the time being, I was using Django to output from the DB, but it doesn't seem to work. So a bug fix note.

Cause: Python3 changes the character code with the environment variable of Ubuntu!

[Be careful of LANG for UnicodeEncodeError when printing Japanese in Python 3] (https://qiita.com/toshihikoyanase/items/47407551d8f3d4e8c39a)

According to this article, Python3 ** changes the character code used depending on the environment variables of the OS ** I'm using Sakura VPS, but Sakura's Ubuntu doesn't include the Japanese package by default, so UTF8 is on the DB side and Latin1 is on the Python console. It seems that a character code error occurred in the Python console

Solution: Introduce Ubuntu Japanese package

So, let's change the default locale for Ubuntu!

''' % sudo apt-get install language-pack-ja % sudo update-locale LANG=ja_JP.UTF-8 % sudo reboot '''

For the time being, the text works

image.png

Recommended Posts

The story that Japanese output was confused with Django
Japanese support for Jupyter PDF output (December 2020 version)
Django function-based view
Django class-based view
The story that Japanese output was confused with Django
The story that Apache dealt with because it was down at AH00144
The story that fits in with pip installation
The story of making a web application that records extensive reading with Django
A story that struggled with the common set HTTP_PROXY = ~
The story that Kivy's Japanese input characters are displayed
The story that the return value of tape.gradient () was None
The story that my pull request was incorporated into Scipy
The story that the new drawing library "HiPlot" was pretty good
The story that Python stopped working with VS Code (Windows 10)
The story that the private key is set to 600 with chmod
The story that the version of python 3.7.7 was not adapted to Heroku
The story that the Homebrew environment was blown away when Anaconda was installed
Output the call graph with PyCallGraph
The story that the guard was confined when the laboratory was converted to IoT
The story of making a module that skips mail with python
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
The LXC Web Panel that can operate LXC with a browser was wonderful
Asynchronous API that combines API Gateway and Step Functions was the strongest story
The story of using mysqlclient because PyMySQL cannot be used with Django 2.2
The story that FastAPI may take supremacy
The advantages and disadvantages of Django that people with one year of experience think
The story of Django creating a library that might be a little more useful
A story that I was addicted to when I made SFTP communication with python
Note that the calculation of average pairwise correlation was very easy with pandas
The _authenticate_with_backend function was obsolete in django auth.autenticate
The story of doing deep learning with TPU
Build the fastest Django development environment with docker-compose
Recreate the django staff registration screen with class
About the matter that was worried about sampling error
A story about implementing a login screen with django
The story of viewing media files in Django
Workaround for the problem that UTF-8 Japanese mail cannot be sent with Flask-Mail (Python3)
A story that required preparation when trying to do a Django tutorial with plain centos7
A story that failed when trying to remove the suffix from the string with rstrip
[Django] Let's try to clarify the part of Django that was somehow through in the test
When I crawl the webapi that appears during rendering, it was played with CORS
Here is one of the apps with "artificial intelligence" that I was interested in.
Code memo that I was having trouble with not being on the discord.py site
Solved the problem that the image was not displayed in ROMol when loaded with PandasTools.LoadSDF.
The story when I was using IntelliJ on Linux and could not input Japanese
The story that sendmail that can be executed in the terminal did not work with cron