473,785 Members | 2,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to read a text file populated by multi-byte chars(e.g. Chinese chars )?

Hi,everybody,

If I create a text file like "Sub WriteTextFile" I can read the file
"file1.txt" using "Sub ReadTextFile" correctly, Whereas If I create the same
text file using NotePad.exe I can only read out these 2 strings: " is a
Chinese person's name" and "English". Need I make some conversion?

Private Sub WriteTextFile
Dim file1 As New StreamWriter("f ile1.txt")

With file1
.WriteLine("ÕÅÁ ¢Ð is a Chinese person's name")
.WriteLine("Eng lish")
.Close()
End With
End Sub

Private Sub ReadTextFile
Dim file2 As New System.IO.Strea mReader("file1. txt")
Dim words As String = file.ReadToEnd( )
file.Close()
End Sub

Thanks in advance,
Peter

Nov 1 '06 #1
0 1172

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3211
by: Kobi Lurie | last post by:
Hello all, I'm trying to make a simple script beginner level script, with just functions. it uses the functions: file_get_contents substr taking into an array the text substr took then array_count_values
4
6660
by: see_mun_lee | last post by:
I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????). <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> ' create and open the connection to the Excel file Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" &...
0
2345
by: Larry Neylon | last post by:
Hi, I'm writing a vbscript application that reads UTF-8 XML containing Chinese characters. Any suggestions how to store these characters in MySql 4.0.x ? Do I need to set a special encoding such as Big5 on the database ? Does MySql support storing UTF-8 ? If so what data types / encoding do I need to use ?
1
2156
by: Antonio | last post by:
With the following page aspx I try to translate one my page from English to Chinese, using UTF8, the result Is that the Chinese characters do not come read correctly, if instead I insert directly the address http://babelfish.altavista.com/babelfish/trurl_pagecontent?url=http://www.etantonio.it/en/index.aspx&lp=en_zh into the browser the page he comes shown correctly in Chinese, if i save it and put it in my site and with the same below...
8
3489
by: Agnes | last post by:
In my .net ,i need to generate an xml file , however, user may input a chinese character, Then , the xml will got something unknow characters. the following is my code, Does anyone know how to solve it ?? Private Sub Init() With AMSXML ..Formatting = Formatting.Indented ..Indentation = 4 ..IndentChar = " " ..WriteStartDocument()
3
7179
by: Cheryl | last post by:
Hi! I am implementing a system that can read Chinese characters from a text file and do some string manipulations. Can anyone suggest a method on how I can do file I/O with Chinese? Thanks.
8
11989
by: pabv | last post by:
Hello all, I am having a few issues with encoding to chinese characters and perhaps someone might be able to assist. At the moment I am only able to see chinese characters when displayed as part of a datagrid. When an input textbox is displayed it does not display chinese characters, but rather the unicode characters stored in the mssql 2000 server backend.
3
2873
by: msnews.microsoft.com | last post by:
Hey there, I'm having trouble reading Simple Chinese characters from an XML document in an ASP file, I want to update the database based on what is in the file. Everytime, I read in the characters they come out as ??. Here's a snippet. Also here is my sample xml file: http://dev4.labwerks.com/research/1_homepage.xml Response.Charset = "utf-8" Set objXML = Server.CreateObject("Microsoft.XMLDOM") Set objLst =...
0
975
by: =?Utf-8?B?TGluenox?= | last post by:
Hi, I have a MFC project here which require me to read chinese character from a text file and display them. However, the chinese txt file have to be save in unicode while my program cannot read unicode file. I am wondering if anyone can help me out if there is any solution that I can take without re-coding my MFC application in unicode format. Thanks
4
4763
by: Sebastian.Pawlus | last post by:
Hi, I have a problem with Chinese words coded in utf-8. I need to display Chinese marks/words with use of GD or IMagick libs. Chinese text that I need to display is written as plain text in .txt file. I'm not pasting that text inside code. When I'm using only read and echo in PHP. Everything looks fine: example: <?php
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.