Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1052

Spanish Characters erratically being saved in MongoDB as non utf-8 characters (�)

$
0
0

Seemingly all of a sudden, we started noticing that non traditional characters like "ñ" "¿" or "é" are being saved as a non utf-8 character "�".

We reverted to previous versions of both our front and back end and the issue is still there, apparently dismissing issues with new code commits.

If we run locally, there is no problem whatsoever.

When we deploy a version, it seems to work for a while, until we refresh or try with a different browser, at which point it fails and seemingly corrupts something within the flow and fails thenceforth.

Our instantiation, and queries are pretty straight forward:

mongoose    .set("strictQuery", false)    .connect(config.MONGO_DB_URI, {      enableUtf8Validation: true, // We initially didn't have this and the back end crashed, now it doesn't but it simply show the corrupted characters.    })export const PostDBModel = mongoose.model<PostDB>("Post", postSchema);const updatePost = await PostDBModel.findOneAndUpdate(      { _id: _id },      { title, content, category, tags },      { new: true }    );

Our stack:

  • React.js in the front end, with a graphQL integration using both Apollo client and server to communicate front and back
  • Node.js in the back end with Typescript
  • MongoDB as DBMS and mongoose as ODM

What could be a potential reason for this?


Viewing all articles
Browse latest Browse all 1052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>