Next.js Discord

Discord Forum

Next 14 has different encoding. My code used to work well with previous versions

Unanswered
Atlantic herring posted this in #help-forum
Open in Discord
Atlantic herringOP
I have /app/most-played/route.js

const imgData = await fetch(imgUrl);
  const imgResponse = await imgData?.json();

  const parsedImgData = JSON.parse(imgResponse);



console logged it and this is what i get

 imgData: 'äå',
  imgResponse: '"ÖÖ"äÖÖÖÖÖÖ"itemsÖÖÖÖÖÖ":ÄäÖÖÖÖÖÖ"_attributesÖÖÖÖÖÖ":äÖÖÖÖÖÖ"termsofuseÖÖÖÖÖÖ":ÖÖÖÖÖÖ"https://boardgamegeek.com/xmlapi/termsofuseÖÖÖÖÖÖ"ååÅåÖÖ""',


what the heck is happening?

3 Replies

I think you should provide more info about your problem
Also why are you parsing image response? Isn't it a json by itself ? Or if the API returns text you should use imgData.text() instead of json
Atlantic herringOP
This was a very weird error. Doing it in another machine didnt produce this error