f# - 在 Suave 中使用非拉丁字符

标签 f# suave

我想在 Suave 中使用非拉丁符号,例如,西里尔文,但得到奇怪的结果

MCVE

open Suave
open Suave.Filters
open Suave.Operators
open Suave.Successful

let app =
    choose [
        GET >=>  OK "Привет, Мир!" 
    ]

startWebServer defaultConfig app

结果

enter image description here

那么,问题是 - 如何修复它?

最佳答案

对于纯文本响应,您需要设置地雷类型编码:>=> 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/

相关文章:

F# 整数比较

f# - F# 中的枚举 Windows

f# - 这个 F# 运算符 <*> 的典型定义/含义是什么

http - 在 Suave 应用程序中上传文件

azure - 通过 FTP 将 Suave 应用程序传输到 Azure

inheritance - F# 静态覆盖

performance - 为什么构建/拼接 F# 报价这么慢?

f# - 这是一个什么样的类型呢?

azure - 从 Internet 访问 Azure VM 中的 Suave 自托管应用程序

f# - Suave 和 Fable.Remoting 中的 MissingMethodException