#content collections - data type - encoding

3 messages · Page 1 of 1 (latest)

zinc marsh
#

I'm working with content collections made out of .json files, and I'm running into encoding problems.

The JSON files are generated by Python, in (what seems to be) valid UTF-8 encoded bytestreams... but when I make stuff out of them in Astro, I get stuff like "brewer’" when it should be "brewery's".

(I tried forcing the json to be ASCII, but that doesn't work either)

I've assumed that Astro would just use the default encoding of my computer, which (I think) is UTF-8 for all kinds of run times.

What's the "right thing to do" here? Do I have to tell Astro what kind of json it can eat or how to eat it?

halcyon ventureBOT
#

Hi @zinc marsh. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain specific information about handling encoding issues with JSON files in Astro's content collections.

However, Astro does have a feature called Content Collections API introduced in Astro 2.0, which is designed to help manage local content like Markdown and MDX files with built-in type safety source (https://astro.build/blog/introducing-content-collections).

For more specific issues related to encoding, it might be helpful to check Astro's GitHub issues or ask for help in the Astro community. You can also refer to the Astro documentation (https://docs.astro.build) for more information.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: