Haskell:simplehttp追加"%0D"?

时间:2016-11-13 19:55:01

标签: string haskell http-conduit

我正在使用simplehttp来查询网页。例如:让webLink =" www.example.com /"和number = 257(从文件中读取数字)。

res <- simpleHttp $ "webLink" ++ number

它在Windows上工作正常,但在Mac上,它将错误404作为其显示路径投射为&#34; www.example.com/257%0D" 我不知道这个&#34;%0D&#34;是因为打印号码给了我257。我试过过滤&#34;%0D&#34;以及如下所示,但由于路径中的%0D,mac仍然显示错误404 ...请建议。

res <- simpleHttp $ (filter (not . (`elem` "%0D")) ("webLink" ++ number))

1 个答案:

答案 0 :(得分:2)

0x0D字符是Windows上换行序列的一个组件,但不是mac。您可能正在从Windows编码的文件中读取一行,其中包含您的mac无法理解的Windows新行,如果没有您的帮助。