And why do you need to write this as concatenation of various strings and characters anyway? 例えばテキストファイルを文字列(String型)として読み込む時、そのテキストファイルの文字コードが何であるかによって、適切なエンコーディング(注)を選択する必要があります。 ASCII(8ビット)形式で配列に入っているデータをintやdouble型に変換したいのですが簡単な方法があれば教えて下さい。 例えば"12.3"(0x31, 0x32, 0x2c,0x33)をdouble型の12.3に、"23"(0x32, 0x33)をint型の23に変換したいので探してみたのですが見つけられませんでした。 Looking at the 2nd code snippet, I guess your problem is that the doubles quotes need to be escaped? Maybe this doesn't answer your question, but you could use two double quotes to escape the quotes character in VB.NET: I'm just guessing: you could use the String.Format method for your purposes: Licensed under cc by-sa 3.0 with attribution required. And why do you need to write this as concatenation of various strings and characters anyway? The absolute ideal (IMO) would be a short but complete program demonstrating the problem - a small console app which does one thing, and a description of what you want it to do instead. 092009-03-09 13:11:24 Jon Skeet, Documentation says that InnerText escapes any < and > that it encounters, since that's what it's for :) – Joey 09 3月. asciiコードは半角スペースで区切って下さい。 文字列→ascii変換 ascii→文字列変換 ascii→文字列変換 092009-03-09 13:18:11 AnthonyWJones. Of course, if this is XML then I'd expect serializing the XML out again to end up escaping the < and > - again, more information about what you're trying to do would be helpful. 092009-03-09 13:18:23, Are you trying to modify a Config file? The second method should work (if you escape the ") as well. I don't really see why you need to use Chr(60) etc at all, other than for the quotes. You can choose from several encoding options to convert a byte array into a string: æ¹æ³: Visual Basic ã§æååããã¤ãã®é
åã«å¤æãã, How to: Convert Strings into an Array of Bytes in Visual Basic, ãã¹ã¦ã®ãã¼ã¸ ãã£ã¼ãããã¯ã表示, 以åã®ãã¼ã¸ã§ã³ã®ããã¥ã¡ã³ã. 目的の文字コードに合ったEncodingオブジェクトを取得する. バイト配列を文字列に変換するときは、いくつかのエンコード オプションから選択できます。 You can choose from several encoding options to convert a byte array into a string: Encoding.ASCII:ASCII (7 ビット) 文字セットのエンコーディングを取得します。 ã§ã³ããé¸æã§ãã¾ãã. – splattne 09 3月. – Joey 09 3月. In my experience, problems with this are as likely to be about viewing strings in the debugger as getting the right strings in the first place. Documentation says that InnerText escapes any < and > that it encounters, since that's what it's for :). I strongly suggest you dump the string out to the console rather than using the debugger - the debugger tries to show you how you could represent the string in code, rather than showing you the contents verbatim. Afaik that's for setting text and you're setting markup. 092009-03-09 13:13:20. Try:-. Shouldn't you use InnerXml in the first place? 作成 09 3月. Note all that Chr marlarky is unnecessary, were you trying to avoid < and > being encoded as XML entities? ASCII code Char(34) = " works fine but Char(60) = < and Char(62) = > are not being read. 092009-03-09 13:12:21, Looking at the 2nd code snippet, I guess your problem is that the doubles quotes need to be escaped? The second method should work (if you escape the ") as well. Shouldn't you use InnerXml in the first place? You'll need to give more information about how you're "seeing" the results. What happens when you just use < and > in your code? 作成 09 3月. Aren't you misusing InnerText a bit here? See my answer below. Afaik that's for setting text and you're setting markup. 私のVBコード内で特殊文字を読むのに助けが必要です。 ASCIIコード 'node.FirstChild.InnerText = " " なしASCIIコードのChar(34)= "正常に動作しますが、CHAR(60)= <とCHAR(62)=>が読み込まれていない。 Need help with reading special characters within my VB code. ãã JIS) - shift_jis), BOMç¡ãã®UTF-8ã§ããã¹ããã¡ã¤ã«ã«æ¸ãè¾¼ã, ãã®è¨äºã¸ã®ã³ã¡ã³ãã®ä¸è¦§ãè¦ã, æ¥æ¬èª (JIS 0208-1990 ããã³ 0212-1990), åè§ã«ã¿ã«ãããµãã¼ããããªã©, æ¥æ¬èª JIS(1ãã¤ãã«ã¿ã«ãå¯)ï¼CP50221ï¼, åè§ã«ã¿ã«ã以å¤ã¯ã50220ãã¨åãï¼, æ¥æ¬èª JIS(1ãã¤ãã«ã¿ã«ãå¯ - SO/SI)ï¼CP50222ï¼, BOMãä»ãã¦ããStreamãªãã°ä»ã®å½¢å¼ã§ããã³ã¼ãã§ããï¼, Streamã«æ¸ãè¾¼ãæã«ã¯BOMãä»ã, ç°å¢ã«ãã£ã¦éãã¨ã³ã³ã¼ãã£ã³ã°ãè¿ãã®ã§ããã¾ã使ç¨ããªãæ¹ãããã, Unicode æåã® ASCII æåã¨ã³ã³ã¼ãã£ã³ã°ã表ãã¾ãã, Unicode æåã® UTF-16 ã¨ã³ã³ã¼ãã£ã³ã°ã表ãã¾ãã, Unicode æåã® UTF-32 ã¨ã³ã³ã¼ãã£ã³ã°ã表ãã¾ããï¼.NET Framework 2.0以éï¼, Unicode æåã® UTF-7 ã¨ã³ã³ã¼ãã£ã³ã°ã表ãã¾ãã, Unicode æåã® UTF-8 ã¨ã³ã³ã¼ãã£ã³ã°ã表ãã¾ãã, ãã®ãµã¤ãã§ç´¹ä»ããã¦ããã³ã¼ãã®å¤ãã¯ãä¾å¤å¦çãçç¥ããã¦ãã¾ããä¾å¤å¦çã«ã¤ãã¦ã¯ã, Windows Vista以éã§UACãæå¹ã«ãªã£ã¦ããã¨ããã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿ã«å¤±æããå¯è½æ§ãããã¾ãã詳ããã¯ã, .NET Tipsããå©ç¨ããã ãéã¯ã. See my answer below. Aren't you misusing InnerText a bit here?