我想在 Suave 中使用非拉丁符号,例如,西里尔文,但得到奇怪的结果
MCVE
open Suave
open Suave.Filters
open Suave.Operators
open Suave.Successful
let app =
choose [
GET >=> OK "Привет, Мир!"
]
startWebServer defaultConfig app
结果
那么,问题是 - 如何修复它?
最佳答案
对于纯文本响应,您需要设置地雷类型编码:>=> setMimeType "text/plain; charset=utf-8"
Set the Content-Type header to the mime type given. Remember that it should include the encoding of your content. So for example, specifying a mimeType value of 'application/json; charset=utf-8' is strongly recommended (but replace 'json' with your own MIME type, of course ;))
关于f# - 在 Suave 中使用非拉丁字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44563880/