简体   繁体   中英

Rest jersey json encoding

I have json responce

"storeId": 1,
   "name": "Тестовый магазин",
   "address": "1й волоколамский проезд д.10",
   "productIdList":    [
            {
         "productId": 1,
         "productName": "Zewa Deluxe Camomile Comfort",
         "price": 21.3,
      },
            {
         "productId": 2,
         "productName": "Аленка. Молочный шоколад(Крвсный Октябрь)",
         "price": 55,
      },
            {
         "productId": 3,
         "productName": "Safeguard. Пенка для детей.",
         "price": 97.5,
      }
   ]
}

My headers is

Transfer-Encoding   chunked
#status#    HTTP/1.1 200 OK
Server  Jetty(6.1.25)
Content-Type    application/json; charset=utf-8

Charset I declare in my REST annotation:

@Produces("application/json;charset=utf-8")

How can I fix the problem with this character encoding?

The problem was in compile encoding, by default Gradle set platform encoding(in my case Windows)

Setting compileJava.options.encoding = 'UTF-8' to my build.gradle fix the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM