Skip to content

Garbled characters may appear when uploading Chinese files. #2628

Answered by JessChowdhury
clhome asked this question in Q&A
Discussion options

You must be logged in to vote

To fix this issue, add the following property to the upload object in your payload.config:

upload: {
    defParamCharset: 'utf-8',
},

Here is a little background as to why...

Payload uses the express-fileupload package to manage uploads. By default, this package has defParamCharset set to latin1. However, we need a character set that supports Chinese i.e. utf-8.

You have full control over the express-fileupload options with Payload, simply pass any valid properties to the upload object in your base payload.config.

Note: here is the defParamCharset definition from express-fileupload:

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@clhome
Comment options

@RiceeeChang
Comment options

@JessChowdhury
Comment options

@RiceeeChang
Comment options

Answer selected by JessChowdhury
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants