Forum Moderators: open
I am parsing an XML file created via a Twitter API call with VBScript in a .vbs file. The XML file is fine, no problems. There are HTML entities in the file that are supposed to represent Japanese characters.
<text>まだ</text>
When my script gets to this line and tries to write the entities to a text file, the script crashes with an, Invalid procedure call or argument, error on the line where I try to write to the text file. This is the code on that line. The error occurs on the second line.
TextStr = XMLLineNode.selectSingleNode("text").Text
[...]
TextFile.WriteLine "<div class=""twitter_text"">" & TextStr & "</div>"
TIA.
its blowing its cookies all over the table because of it
is it a mix of English and Japanese or pure Japanese
Curiously, the same exact code works fine in an .asp file, which is where I first tested it before moving it to a .vbs file cause Twitter kept alternating between speedy and sluggish retrieval times, so I decided to do the conversion once every 30 minutes or so and store it in a text file.
The only difference between the two formats was with .asp I saw question marks instead of actual Japanese characters when displaying the .txt file in the browser, while in .vbs it crashed when writing the HTML entities to the .txt file during the xml conversion.
CreateTextFile Method [msdn.microsoft.com]
I have a new problem now though. And I'm not sure how to show you all what it is because the forum software makes a mess of it. So let me see if I can explain it.
Instead of writing the HTML entities to the .txt file, it's writing the actual characters. That's fine I suppose. But when I try to display them on an .asp page what I see is all question marks.
Clearly I don't have a lot of experience with displaying foreign languages. This is the first time I've ever needed to display something in a non-English alphabet. So what's the right way to do it please?
VBScript HTML Encode [codeproject.com]
Combining that HTMLEncode function and a Regular Expression so that I only encode the HTML entities gives me characters instead of question marks in the text file I'm creating.
Next I need to figure out how to make those characters from the text file display as Japanese symbols instead of question marks on the web page.