-2

I am importing a JSON file and inserting the data in postgreSql. The JSON file contains some character like 'ü','ä' which are showing box icon in db. So returning question mark icon in place of special characters in the API response.

Beginner
  • 670
  • 12
  • 25
  • 1
    Sounds like your encoding is wrong. Make sure the application, file and the database agree on the same encoding - ideally, a unicode encoding. – Luaan Jul 29 '15 at 07:58
  • See also: [Character Set Support](http://www.postgresql.org/docs/9.4/static/multibyte.html) – Corak Jul 29 '15 at 07:59
  • That's great. Now ***how*** are you doing it? – nathanchere Jul 29 '15 at 08:00
  • @Luaan: Thanks, I was passing only stream object. Needed to pass the encoding parameter. (var sr = new StreamReader(jsonStream, Encoding.GetEncoding("iso-8859-1"))) – Beginner Jul 29 '15 at 12:40

1 Answers1

2

I was passing only stream object. Needed to pass the encoding parameter to StreamReader.

using (var streamReader = new StreamReader(jsonStream, Encoding.GetEncoding("iso-8859-1")))
Beginner
  • 670
  • 12
  • 25