Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于为加拿大用户部署的大多数应用程序,我们需要同时支持英语和法语。默认情况下,light-4j 应用程序将返回 ?? JSON 响应中的法语字符。如何处理法国的回应?
如果使用 ByteBuffer,您可能需要在响应标头中设置编码器。当响应为 String 时,无需指定为 UTF-8,因为它是 JSON 的默认值。另一种选择是在将字节放入 ByteBuffer 之前以 UTF-8 对字节进行编码。答案是针对 Undertow/Light-4j 服务器的。
Exchange.setResponseHeaders(Headers.CONTENT_TYPE, “application/json;charset=utf-8”)
UTF-8 是格式