Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

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

default discord avatar
koakh2 years ago
5

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

"corrupted"

, 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
    jonathanzappala2 years 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
    linobino12 years ago

    It helped me, thank you!

  • default discord avatar
    koakh2 years 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

    @633043972021026855

    and

    @1024331309486719056

    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
    linobino12 years ago
  • default discord avatar
    koakh2 years 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?



    @1024331309486719056

    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

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.