Media Upload stored UTF-8 filename is change Portuguese accent characters

default discord avatar
4 months ago

when I upload a file with filename

A História de Trovão.pdf

it show OK in Create New

but after I click Save, the filename in Admin and database is


, seems some problem in UTF-8 encoding,

the stored in database will be

A História de Trovão.pdf

and not

A História de Trovão.pdf

like it should be,

this may occur in all languages to

seems like double encoding problem....

how can I fix it?

update : I found that using local api and

await payload.create<Media>

works, and all characters aren't modified 🙂

only in UI it gives above error

  • default discord avatar
    Jonathan Zappalà
    4 months ago

    Hello, I had the same issue which I was able to solve with the following in payload.config.ts:

    upload: {
          // save files with right encoding (utf8)
          defCharset: 'utf8',
          defParamCharset: 'utf8',

    I hope that this may help !

  • default discord avatar
    4 months ago

    It helped me, thank you!

  • default discord avatar
    4 months ago

    I will try asap, other question is how I import the Media type in a local api script?

    I export the types and import it but vscode keeps complaining, I can send the script and imports asap, currently i'm on phone

    Thanks @Jonathan Zappalà and @linobino1

    this utf-8 thing should be the default IMO

    but sure core devs must have a good reason to not use it as default, but mention in the docs will help

  • default discord avatar
    4 months ago
  • default discord avatar
    4 months ago

    the other problem im my batch import media files, is that seems that await on payload.create<Media> dont wait and if I try to import it crash after a few files, I use a sleep time to override this and move on, but seems that this is not the right way......does anybody has the same issue when try to batch import/create a bunch of files, like more than 75?

    @linobino1 I see that in your link you use await Promise.all

    that seems the missing piece that I was looking for 🙂

    I will try both fixs sugested here and leave a feedback after, thanks budies

    this works ! awesome

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.