掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
バイナリファイル読み込みで”変換バッファのオーバーフロー”について (ID:119876)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
はじめまして。 同様の現象が発生しましたが、解決できましたので書き込みます。 結論から書きますと > Do While br.PeekChar() <> -1 を > Do While br.BaseStream.Position < br.BaseStream.Length としたら動作しました。 当方のExceptionの内容です。 {System.ArgumentException} [System.ArgumentException]: {System.ArgumentException} HelpLink: Nothing InnerException: Nothing Message: "変換バッファのオーバーフローです。" Source: "mscorlib" StackTrace: " at System.Text.UTF8Encoding.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex, UTF8Decoder decoder) at System.Text.UTF8Decoder.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex) at System.IO.BinaryReader.InternalReadOneChar() at System.IO.BinaryReader.Read() at System.IO.BinaryReader.PeekChar() よくわかりませんが、UTF8へのエンコードで不正なキャラクタがあるようです。 同一のファイルだと同一の場所で発生します。ですので、何バイト目にExceptionが発生するかは元のファイルによります。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.