Client double-clicks an exported list in Excel and Chinese becomes question marks, but Notepad shows it normally—is the file corrupted or is it the wrong way to open it?
Conclusion: When a client double-clicks an exported list and all Chinese characters turn into question marks, but the file looks normal when sent back and opened in Notepad, the file is usually not corrupted. Excel guesses the encoding from the local code page when double-clicking, and the file itself may be UTF-8 without a BOM. Missing BOM is only one common cause. The export side may write GBK, an intermediate layer may have converted the encoding once, or the user may switch to the import wizard, and the results will differ. Based on common 2026 delivery experience, check the first few bytes of the file header first, then locate the issue across the source, write, and open stages. It is usually better to deliver separately for machines and for people.
Notepad is normal but Excel shows garbled text: the difference is in the reading rules
Newer Notepad and most editors perform encoding detection, and when they see valid UTF-8 bytes they display them as UTF-8. Excel double-clicking a CSV relies more on a BOM or the ANSI code page in the system locale. The same file is read by two sets of rules, and different results do not mean the file is corrupted. If it works on another computer, that is often because the system locale, Office version, or language pack is different.
- Check the file header: A UTF-8 BOM is the three bytes EF BB BF, which can be seen with a hex viewer. Without these three bytes, Excel double-click is more likely to guess by the local code page.
- Check the byte distribution: Chinese characters in UTF-8 are often grouped in three bytes, while GBK is mostly grouped in two bytes. Garbled text such as '锟斤拷' and a leading '' have different causes.
- Check the way it is opened: Excel's Data → From Text/CSV lets you specify the encoding manually, while double-clicking basically relies on guessing. It is normal for the same file to produce different results with the two opening methods.
First locate which layer is broken: check the source, write, and open stages
Encoding problems are easy to fix only at the visible layer. An export pipeline generally has three stages: the source system retrieves data, the application writes out bytes, and the client opens the file. If the encoding is inconsistent at any stage, Chinese text will have problems. I usually check the three stages of source, write, and open, and each stage answers only one question.
- Source: Whether the database connection string, table field character set, and export client are consistent. When the character set declared at the connection layer is inconsistent with what is actually stored, the data read out may already be replacement characters, and later transcoding cannot recover the original text.
- Write: Whether the output stream, CSV library, and template engine explicitly specify the encoding. Many languages default to the platform character set. When the development machine is UTF-8 and the server uses another setting, local testing may not reveal the problem.
- Open: Whether the user double-clicks, drags the file into Excel, or uses the import wizard; whether they use Excel, WPS, Numbers, or a script parser. You cannot accept the result based only on how it opens on your own computer.
Once the three stages are separated, the conclusion is usually clear: if the source has a problem, fix the data pipeline; if the write has a problem, specify the encoding explicitly; if the open stage has a problem, state the opening method clearly in the delivery notes, or provide an Excel-friendly version separately. Adding transcoding to the export code right away often just changes the appearance of the garbled text, and testing has to start over again.
Whether to add a BOM depends on who reads the file
A BOM is a signal to the reader: this is UTF-8. For guessing-based scenarios such as Excel double-click, it saves trouble. But it appears as content before the first field, and when a script reads the first column by bytes, an invisible character is easy to add. Integration partners often run into this problem here.
- Option A: UTF-8 with BOM. Chinese text is generally normal when double-clicked in Excel. The cost is that programs reading the file must skip the BOM; otherwise, the first column header contains an invisible character.
- Option B: UTF-8 without BOM. Program integration is easier, and common languages and Linux toolchains read it cleanly. The cost is that some Excel double-click scenarios may still show garbled text, requiring delivery notes or the import wizard.
- Option C: GBK/GB18030. Compatibility with older intranet Windows environments is better. The cost is poor cross-platform support, emoji and some rare characters cannot be stored, and future international business integration may require rework.
Based on 2026 project delivery experience, a more stable approach is not to choose one of the two, but to split by audience: use UTF-8 without BOM for machine reading, and provide a separate BOM-equipped friendly version for people using Excel. This can be two entry points or one export parameter. The typical range for the incremental work is half a day to one day of development and half a day to one day of integration testing. What is saved is the back-and-forth of integration partners repeatedly reporting that the first column header has an extra question mark.
At delivery: how to define an export convention
Encoding is only part of CSV delivery. Chinese garbled text, phone numbers turning into scientific notation, dates turning into numbers, and fields containing commas causing column misalignment often appear together. Below are several items in acceptance order; the items completed can be checked one by one to decide whether the delivery is acceptable.
- Encoding and BOM: Explicitly specify UTF-8 and split by audience; do not rely on the runtime environment's default character set.
- HTTP headers: Content-Type with charset=utf-8; use the RFC 5987 filename* form for the download file name to reduce Chinese names becoming percent-encoded in some browsers.
- Delimiter and escaping: When a field contains commas, line breaks, or double quotes, wrap it in double quotes and escape internal double quotes in pairs; otherwise, columns will shift and look like an encoding problem.
- Leading zeros and large numbers: In the export notes, remind users to import order numbers and phone numbers as text; relying only on Excel automatic detection may truncate the precision of long numbers.
- Dates and data volume: Use ISO 8601 or a fixed date format and state the time zone; CSV is relatively stable within tens of thousands to the low hundreds of thousands of rows, and for several hundred thousand rows or more, consider pagination or streaming xlsx.
Delivery experience: In one intranet project, the client's Office version was fixed, and the integration partner also used a script to fetch files on a schedule, with a budget for only one round of changes. At first, only one UTF-8 file with BOM was provided, but the script's first-column validation failed and caused one round of rework. Later, the default was changed to no BOM, a separate download button with BOM was provided, and the encoding was marked in the file name. Only then were the two types of users satisfied. The cost was one more entry point on the export page and about half a day to one day of extra testing to check the first column and Chinese samples.
Applicable scenarios and boundaries
Suitable cases: Statements, lists, and ledgers downloaded for business users that need to be opened directly in Excel; cross-system batch import templates that non-technical colleagues need to fill in; exports containing Chinese or multilingual content. In these scenarios, clearly documenting the encoding and opening method is usually more effective than repeatedly changing code.
Cases where it is not necessary or not applicable: For pure API integration, when the file is only read by a program, there is no need to add a BOM for Excel, nor to change the entire pipeline to GBK; when data volume reaches several hundred thousand rows or more, CSV plus Excel is itself not a suitable carrier, and pagination or streaming xlsx writing should be considered; if garbled text appears on only one machine, first check that machine's locale settings and opening method, and do not change the export code first.
One-sentence boundary: Whether the file's user is human eyes or a program determines the BOM and encoding strategy; data volume and usage frequency determine whether CSV is still the right carrier.
Common questions
If the integration partner says that after adding BOM, the first column header has an extra question mark, is it caused by the BOM?
Very likely. The BOM appears as an invisible character at the beginning of the file, and a script that reads the first column by bytes will carry it into the header; let the reader skip the BOM, or provide a separate BOM-free version for machine integration.
The same file opens normally in WPS but shows garbled text in Microsoft Excel—does that mean the file has no problem?
It means the file bytes are consistent, but it does not mean all opening methods are normal. The two programs have different default encoding rules. For delivery, use the actual software of the user as the standard, and attach import steps if necessary.
The exported content contains emoji and rare characters. Can it still be stored in GBK?
Not recommended. GBK cannot cover emoji and some rare characters, and they may be replaced or cause errors when written. When the content contains such characters, keeping the entire pipeline in UTF-8 is more reliable.
If I only change the API response header to charset=utf-8, will Excel open it normally?
Not necessarily. The response header affects download and browser parsing, but Excel double-click may still guess by the local code page; it also depends on whether the file has a BOM or whether the user uses the import wizard.
Next time you encounter Chinese garbled text, do two things first: use a hex viewer to confirm the file header and actual encoding, then confirm whether the user opens it by double-clicking or parses it with a script. Delivering separately for people to view and for machines to read can prevent most rework at the requirements confirmation stage. When data volume or character range exceeds the comfort zone of CSV and Excel, switch carriers in time; it is more convenient than repeatedly patching the encoding.
-
Ops says Redis memory is only at 60%, but a batch of users was kicked back to the login page this morning—is adding memory now still in time?
Date: Nov 29, 2026 Read: 6
-
Query API works in the page but downloads when pasted into the browser address bar—should I check the gateway first or the response headers?
Date: Nov 28, 2026 Read: 8
-
Sometimes a user's avatar briefly shows someone else's, and re-uploading fixes it—does adding a random string to the filename help?
Date: Nov 27, 2026 Read: 16
-
After switching the site to HTTPS, images in old articles are blank on the client side but load fine for us—does that mean we don’t need to touch the image library?
Date: Nov 26, 2026 Read: 22
-
Customers say they never receive the SMS code while our backend shows every send as successful—at acceptance, should the issue count against the channel or against us?
Date: Nov 25, 2026 Read: 27




