Fix Chinese Characters Disappearing When Uploading PDF Forms to SQL Server
Question details
Users report that Chinese characters extracted from an electronic PDF form display incorrectly or disappear completely once the data is uploaded and stored in Microsoft SQL Server.

- Product
- Microsoft SQL Server
- Device & OS
- not provided
- Scenario
- Extracting form data containing Chinese text from a PDF file and inserting it into a SQL Server database via an application connection.
- Observed behavior
- The Chinese characters are lost, replaced by question marks, or rendered as garbled text upon retrieval from the SQL database.
Before modifying your database schema or application configuration, ensure you have full administrative access to the SQL Server and back up the affected database tables to prevent accidental data loss during testing.
Update Database Columns to Support Unicode (NVARCHAR)
Change your SQL Server table columns to a Unicode-compatible data type so they can store multi-byte characters like Chinese text.
Standard VARCHAR columns in SQL Server use non-Unicode encoding, which generally does not support Chinese characters unless the database collation is specifically set for it. Changing the column type to NVARCHAR ensures that Unicode characters are safely stored regardless of the server's default collation.
Log into SQL Server Management Studio (SSMS) and locate the specific table and columns where the PDF form data is being inserted.
Change the data type of the target columns from VARCHAR or CHAR to NVARCHAR or NCHAR. You can do this via the table designer or by running an ALTER TABLE SQL script.
When inserting data, ensure your application prefixes string literals with a capital 'N'. For example, use INSERT INTO TableName (ColumnName) VALUES (N'中文') instead of just using standard quotes.

Verify Application Database Connection Encoding
Ensure the application parsing the PDF and communicating with SQL Server uses proper UTF-8 or Unicode connection settings.
Ensure Proper PDF Font Embedding
Confirm that the original PDF form has the correct Chinese fonts embedded so data extraction tools can read it properly.
Create and Export PDF Forms Seamlessly with WPS Office
While SQL database configurations must be handled on the server side, ensuring your PDF forms are correctly built with embedded fonts and accurate UTF-8 encoding is the crucial first step to preventing data loss. WPS Office provides robust, professional PDF tools to create, manage, and export form data flawlessly.
- 1. Open the PDF Module: Launch WPS Office and navigate to the PDF suite to start a new document or open an existing file.
- 2. Create or Edit Form Fields: Use the Form tools to add interactive text fields, ensuring you select a universally supported font for Chinese characters in the field properties.
- 3. Export Data Safely: Fill the form and save the document. WPS Office ensures the document encoding remains intact, ready for secure extraction to your database.

Frequently Asked Questions
Why do Chinese characters turn into question marks in SQL Server?
This typically occurs when the target column is configured as a non-Unicode data type like VARCHAR or CHAR. These data types do not support multi-byte characters unless a specific Chinese collation is set, resulting in the database replacing unrecognized characters with question marks.
How can I tell if the data loss happens during PDF extraction or SQL insertion?
You can isolate the issue by logging the extracted data to a plain text file (saved in UTF-8) immediately before your application executes the SQL INSERT command. If the characters look correct in the text file, the database or connection string is at fault. If they are already corrupted, the issue lies within the PDF extraction logic or the PDF file itself.
Does the PDF software used to fill the form affect the encoding?
Yes. If the PDF viewer or editor used by the person filling out the form does not properly handle Unicode or fails to embed the required Chinese fonts, the form data may be saved with corrupted encoding, making it impossible to extract the text accurately later.




