如何使用System.IO.FileStream阅读希伯来语文本?

Jon*_*yle 2 c# filestream

我错过了什么或System.IO.FileStream不读取包含希伯来语的Unicode文本文件?

    public TextReader CSVReader(Stream s, Encoding enc) 
    {

        this.stream = s;
        if (!s.CanRead) 
        {
            throw new CSVReaderException("Could not read the given CSV stream!");
        }
        reader = (enc != null) ? new StreamReader(s, enc) : new StreamReader(s);
    }
Run Code Online (Sandbox Code Playgroud)

谢谢乔纳森

Luc*_*ero 5

FileStream只是一个字节流,它与语言/字符集无关.您需要一种编码来将字节转换为字符(包括希伯来语)并返回.

有几类来帮你,最重要的是System.Text.EncodingSystem.IO.StreamReaderSystem.IO.StreamWriter.