Reputation: 3819
I am currently working with a 3rd party sports data feed that I call periodically using node to update my database. This feed is ISO-8859-1
encoded.
My problem is that client devices consuming my data through my APIs, will not be using ISO-8859-1 to display it.
Is there any way to keep the ISO-8859-1 character representation such as áéíóú when I encode to UTF-8 other than mapping the characters I want to replace?
I am running this on AWS lambda and using this utf8 encoder/decoder npm package
Thanks!
Upvotes: 2
Views: 474
Reputation: 53607
Use iconv, the universal solution to encoding switching: https://www.npmjs.com/package/iconv
Convert your incoming data to UTF8, when you get it, then store it as UTF8 in your database (and never anything else), and then serve it from that database as UTF8 to your clients.
Upvotes: 2