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
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 !
It helped me, thank you!
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
have a look here:
https://github.com/payloadcms/payload/discussions/1834the 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
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.