question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSV report in Chinese and not English

See original GitHub issue

Describe the bug

When requesting statistics CSV download (http://127.0.0.1:8089/stats/requests/csv), the report is in Chinese and not English.

Expected behavior

Report in English.

Actual behavior

Generated report CSV is in Chinese.

Steps to reproduce

Start locust, run any test, click on the “Download Data” tab, choose “Download request statistics CSV”.

Environment

  • OS: Ubuntu 18.04 LTS
  • Python version: 3.6.9
  • Locust version: 2.8.1
  • Locust command line that you ran: locust
  • Locust file contents (anonymized if necessary):
import time
from locust import HttpUser, task, between, constant

class QuickstartUser(HttpUser):
    wait_time = between(1, 5)

    @task
    def view_items(self):
        self.client.get("/administer-site.htm")
        self.client.get("/documentPack.htm?documentPackId=1")
        self.client.get("/documentPack.htm?documentPackId=2")
        wait_time = constant(1)

    def on_start(self):
        self.client.post("/login.htm", json={"username":"redacted", "password":"redacted"})

    def on_stop(self):
        self.client.post("/login.htm?action=signOut")

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
lisenetcommented, Feb 16, 2022

VS code says it is UTF-8. If I reopen it as UTF-16 it does look like chinese, maybe that is the problem.

Thanks for checking. My app defaults to UTF-16, hence the Chinese characters. I’ll switch to UTF-8. This issue can be closed.

0reactions
cyberwcommented, Feb 16, 2022

If we really wanted to we could optionally include a BOM when writing the csv file (essentially adding encoding="utf-8-sig" when opening the file for writing) https://stackoverflow.com/questions/57152985/what-is-the-difference-between-utf-8-and-utf-8-sig

But it is kind of considered to be invalid UTF-8 to do so https://softwareengineering.stackexchange.com/questions/372692/should-utf-8-csv-files-contain-a-bom-byte-order-mark

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Characters Issue in CSV Export - Salesmate
For example, you usually view files in English, and the CSV is in Chinese. The file will open correctly in notepad (or another...
Read more >
Unicode/UTF-8 characters (Chinese characters, Barcodes, etc ...
Viewing and Editing CSV files with Unicode characters ; Open Excel from your menu or Desktop. DO NOT double-click the exported file to...
Read more >
Create a csv file which including English and Chinese ...
As far as I know, the issue may be caused by that normal .csv file doesn't support Chinese characters. When we type some...
Read more >
How to Export Chinese and Non-English Characters to CSV ...
Comma; Tab; Click “Next”; Click “Finish”. Note: If the file is done correctly, you should see Chinese characters in the ...
Read more >
How do I export an Excel file with Chinese characters to a CSV?
Open the CSV file from Excel by clicking File > Open > Text files (.prn, ... I have tried Windows Chinese and English...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found