haskell在控制台输出中文 发表于 2025-12-31 分类于 haskell , 基础 1234-- "您好"putStrLn "您好"-- "\24744\22909"print "您好" 其中print函数打印中文会乱码而putStrLn不会,这是因为print内部会调用show函数,show函数会将中文转为unicode编码。 所以如果需要打印中文字符串可以使用putStrLn,如果需要打印一个对象,而对象的属性值包含中文,可以重写show函数,再使用print输出。