- PR -

スマートモバイルアプリケーションでの日本語の処理に関して

1
投稿者投稿内容
ゆき
会議室デビュー日: 2004/06/08
投稿数: 2
投稿日時: 2004-06-08 19:11
基本的な内容で、申し訳ないのですが、VS.NET2003でCE.NETスマートモバイルアプリケーションを開発中なのですが、漢字を含むテキストファイルの文字列をStreamreader若しくは、Textreaderで読み込んでも、漢字(日本語)を読み取ることが出来ません。
どうすれば、漢字も含めて取得することが出来るのでしょうか?
かずくん
ぬし
会議室デビュー日: 2003/01/08
投稿数: 759
お住まい・勤務地: 太陽系第三惑星
投稿日時: 2004-06-08 19:24
原因はおそらく、エンコーディングの指定あたりだとは思いますが、念のため、どのような処理を行っているか知りたいので、問題個所のソースを提示してください。

ゆき
会議室デビュー日: 2004/06/08
投稿数: 2
投稿日時: 2004-06-08 23:25
ソースの件ですがヘルプのサンプルコードのまま記述しました。
Imports System
Imports System.IO

Class Test
Public Shared Sub Main()
Try
' Create an instance of StreamReader to read from a file.
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
Console.WriteLine(Line)
Loop Until line Is Nothing
sr.Close()
Catch E As Exception
' Let the user know what went wrong.
Console.WriteLine("The file could not be read:")
Console.WriteLine(E.Message)
End Try
End Sub
End Class
Jubei
ぬし
会議室デビュー日: 2002/03/02
投稿数: 830
お住まい・勤務地: 関西
投稿日時: 2004-06-09 00:37
諸農です。

引用:

コード:
            Dim sr As StreamReader = New StreamReader("TestFile.txt")
            Dim line As String




StreamReaderのコンストラクタに読み取りたい漢字コードの
Encodingクラスを渡してみるとどうなりますか?

_________________
諸農和岳
Powered by Turbo Delphi & Microsoft Visual Studio 2005

十兵衛@わんくま同盟
http://blogs.wankuma.com/jubei/
1

スキルアップ/キャリアアップ(JOB@IT)