Convert A Unicode Text File To ASCII
I'm trying to read a text file into visual basic, change a part of it, and write it back out a text file. I had been having problems using OPEN (always resulted in an error 36), even though I had tried using LOF and EOF.
I found that the problem was the text file that I am trying to read from is in Unicode. Is there an easy way to convert this text file into an ASCII text file before I read from it?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert ASCII To Unicode And Back??
This may be much simpler than I think, but I haven't found an answer yet...
I need to convert ASCII characters to Unicode and back.
I'm looking to get the actual code that I can use, say in a web app. i.e. "u00e9" (I understand I'll have to add the 'u' myself...)
So, how can I input "A" and get the correct unicode equivalent?
Thanks.
Help Required. Writing Unicode Characters Into Ascii File
Hi ,
I need a help in handling double byte characters( Japanese, Chinese kanji characters) and writing into an Ascii file.
My requirement is to write data into the file in fixed positions., Eg. col 1-40 will have one value, 41-72 will have another value and so on. The column positions are fixed for each value. If the value doesn't occupy the entire column width, then it has to be filled with blank spaces. For eg., if the col1 value is "Hello" then the remaining 35 positions will be filled with blank spaces.
Now suppose I write a Chinese/japanese character, then every character being a double byte character, it is supposed to occupy 2 positions. Suppose a string has 5 double bytes, then it is supposed to occupy 10 column positions in ascii file. Now because the col1 width is 40 , now I'm supposed to add only 30 blank spaces, otherwise it'll spill over into the next column.
( If the file opened with a proper code page , then it will show the actual characters, but if it is opened with a English code page, then you'll actually see these characters occupying 10 positions but all of them appear as junk.)
So in my VB code, I'm currently doing this:
First convert string into byte array,
Loop over byte array, and check if the character is a double byte or not.
(Because VB stores all characters as unicode, byte array would occupy the double the size of a string.
So if the character is a double byte, then both b(0) and b(1) to have value greater than 0.
If the character is a Ascii, then b(0) will have value greater than 0, but b(1) will be 0.
I checked the AscW value for these characters, some are greater than 255 and some have negative values also.)
b = myStr
For i = 0 To UBound(b) Step 2
If b(i + 1) <> 0 Then'Implies double byte character
NoOfDoubleByte = NoOfDoubleByte + 1
End If
Next
then based on the no. of double bytes, reconstruct the string with appropriate no. of spaces.
Suppose the string is supposed to occupy positions 1-40, then decrement the No of double bytes in the string and add that many spaces.
mystr = mystr & space$(40-(len(mystr + NoOfDoubleByte ))
Then finally write this into an ascii file.
Open FileName For Append As #intFile
Print #intFile, myStr
Now the problem.
The logic appeared to work fine so far. But suddenly I find that there are some Japanese characters, though being double byte is appeared to occupy only one position,. ( When opened in note pad with a English code page , a few charaters have occupied 2 positions , but a few of them have occupied only one position.)
so this entire logic of building string has gone haywire. Can some one direct me to the correct way of handling this.
Any help is highly appreciated.
Regards
Rajesh
Need Quicker Read And Reformat Of Ascii|Unicode File Content
It started out as a simple routine that used the good ol' Input function to read the contents of a plain-text ASCII file into a string variable, applying a few simple sanity checks (limiting the returned string to a certain size, etc.)
Then it grew. First, it needed to not only return the original string, it had to chop up the string and return it as an array of individual lines (divided wherever a CR-LF delimiter was found). Then Unicode and other double-byte formats came into it, so it also needed to return the data as a byte array to keep it from getting corrupted.
The result is an inefficient monster that takes an inordinate amount of time to read any file that's larger than 10K or so. Go up to 64K, and you're looking at 5 seconds or more delay time. Terrible.
I've pounded around with various implementations of Input and InputB , tried StrConv without success, and even tried to get creative by using a hidden RTB for its .LoadFile method. The only working code I've come up with is the inefficient monster I just mentioned. Here's what it looks like.
The function returns all its data via this user-defined type:
VB Code:
Public Type FILEINFO Error As Boolean 'File-reading error flag Diag As String 'Error diagnostic string Contents As String 'File contents as a single string ContentsA() As String 'File contents as an array of lines (broken at CR-LF) ContentsUA As Long 'Upper bound of the ContentsA array ContentsB() As Byte 'File contents as a byte array ContentsUB As Long 'Upper bound of the ContentsB arrayEnd Type
Here's the 'heart' of the function. Surrounding and within this code are the sanity checks that I mentioned above. "Split_Lines" is another function that searches the string for CR-LF delimiters and returns the string array.
VB Code:
Open File_Spec For Binary Access Read As #File_Num 'Assign array upper bound and re-dimension it Retrieve_File.ContentsUB = LOF(File_Num) ReDim Retrieve_File.ContentsB(Retrieve_File.ContentsUB) As Byte 'Read the contents of the file into the byte array and then close it. For Loop_Index = 0 To Retrieve_File.ContentsUB Retrieve_File.ContentsB(Loop_Index) = AscB(InputB(1, #File_Num)) Next Loop_Index Close #File_Num 'Assign return values and exit. Retrieve_File.Error = False Retrieve_File.Diag = "" Retrieve_File.Contents = "" For Loop_Index = 0 To Retrieve_File.ContentsUB Retrieve_File.Contents = Retrieve_File.Contents & Chr(Retrieve_File.ContentsB(Loop_Index)) Next Loop_Index Retrieve_File.ContentsA() = Split_Lines(Retrieve_File.Contents) Retrieve_File.ContentsUA = UBound(Retrieve_File.ContentsA)
Does anyone have any guidance on how to pare down this elephant, back into the mouse that it should be?
-- JDM
Extended Ascii/unicode String Conversion To Stanard Ascii
I encountered problems when sending certain characters from Windows VB to IBM Mainframe Cobol/DB2 such as
‘(left single quote) or ’(right single quote). All the characters after the extended ascii got cut off. I don't have problems when sending '(single quote).
Is there any vb functions to convert it? Or maybe changing the
XEOLEDB mapping below would fix it (sample code below)?
{L"DESCRIPTION4", NULL, 68,STANDARD_COL_FLAG, 56, DBTYPE_BSTR, 0,0,0},
I am not familiar with IBM Mainframe and the service connecting VB to it. My only solution right now is to use the replace function but I am afraid there will be a performance problem.
thanks
clark
How To Convert It To ASCII File
I download a log file from SUN server,if i open it with notpad,it looks like: ???? % @#w./.....; it's a binary file , my custumer can't read it unless it is a ASCII file.so i want to know how to convert it to ASCII file readable with .TXT or .XLS
maybe I should use following :
open "d:log001" For Binary As 1
...
...
Get .....
...
Close 1
Open "d:
esult.txt" For Random As 1
.....
Put ...
but it's difficult to know the rule of binary file,
any advice is very useful to me!thanks
How To Convert Ascii Text To Utf8 Text In Vb6
hi everyone.
i use mysql as a database in vb6 . utf8 is used in mysql but ascii is used in vb6 so that i wanna adapt these two ones.
how can i convert ascii to utf8.
i'm really jaded ! help me please.
Convert A Binary File To Ascii String
Dear All:
I have a problem on converting a binary file to a Ascii String.
The following is a sub to convert an input binary String to ascii string but I found that
it does not working
Can someone point out where did I do wrong???
Thanks in advance
public Sub Bin2Asc(strBin as string, strAsc as string)
Dim lLen as Long, i as Long, strBin2 as string
lLen = len(strBin)
strAsc = ""
for i = 1 to lLen
Dim strTmp as string
Dim btByte as Byte
strTmp = Hex(Asc(mid$(strBin, i, 1)))
If len(strTmp) < 2 then
strTmp = "0" & strTmp
else
If len(strTmp) = 4 then
lLen = lLen - 1
End If
strAsc = strAsc + strTmp
If i = lLen then
Exit for
End If
next i
End Sub
Convert Ascii Constant To Ascii Value With Program
How would I go about doin the following? If a string contains "vbKeyF1", how would i get vbKeyF1's ASCII value equivalent (ie: 112) to be written in another string?
Edited by - Marce22 on 10/10/2003 7:04:38 PM
Unicode To AscII
How do you convert a Unicode string to an AscII string ?
Thx
<font color=green>Do or do not
There is no try</font color=green>
Ascii To Unicode
I have this problem....
i have these characters : Âû
which are supposed to be a chinese character
Âû should be Chr(38622) or 雞
But how do I get VB to change Âû to 雞 or Chr(38622)
Unicode--->ASCII
hi im grabbing data from a address and i want to make the address value appear in ASCII instead of #'s how would i go about this?
Letter A-Z,a-z Unicode Or Ascii ?
Hello, how to check If text is NOT ASCII, changed to ASCII, possible ?
Or can you tell me letters "A-Z","a-z","0-9","!@#$%^&&*()"
only ascii format, is not UNIcode, UTF8 format ?
Please!
VB Emits Unicode Or ASCII?
I thought VB prints (I mean the Print method) Unicode, but I was surprised. Here's what I did and also there's what I got.
Code:
Public Sub Main()
'Purpose: I wanna see if VB prints to file Unicode or ASCII.
'Expected Result: I expect Unicode since I have believed VB does everything in Unicode
'Observation: Oops! I see ASCII chars! What????
'Poor me thinks: I don' have MSDN on my system and can't see no help for the Print
' method 'coz I remember having read about the character set Print method
' follows in the MSDN in my last birth.
Dim StrData As String
Dim StrFileName As String
StrData = InputBox("Write some text here. Anything. It doesn't have to " & _
"make sense. Lorem Ipsum if you like.", "Write something...", "Lorem Ipsum")
If Trim(StrData) = vbNullString Then Exit Sub
StrFileName = App.Path & "Lorem Ipsum.txt"
WriteToFile StrData, StrFileName
Shell "C:Program FilesHHD SoftwareHex EditorHex Editor.exe " & _
Chr(34) & StrFileName & Chr(34), vbMaximizedFocus
End Sub
Public Sub WriteToFile(ByVal Text As String, _
ByVal FilePath As String)
Dim IntFile As Integer
IntFile = FreeFile
Open FilePath For Append As #IntFile
Print #IntFile, Text
Close #IntFile
End Sub
Plain evident I thought wrong. Thoughts? Perhaps I need a confirmation.
VB prints:
(1) ASCII
(2) Unicode
<Question Mark>/
VB Emits Unicode Or ASCII?
I thought VB prints (I mean the Print method) Unicode, but I was surprised. Here's what I did and also there's what I got.
Code:
Public Sub Main()
'Purpose: I wanna see if VB prints to file Unicode or ASCII.
'Expected Result: I expect Unicode since I have believed VB does everything in Unicode
'Observation: Oops! I see ASCII chars! What????
'Poor me thinks: I don' have MSDN on my system and can't see no help for the Print
' method 'coz I remember having read about the character set Print method
' follows in the MSDN in my last birth.
Dim StrData As String
Dim StrFileName As String
StrData = InputBox("Write some text here. Anything. It doesn't have to " & _
"make sense. Lorem Ipsum if you like.", "Write something...", "Lorem Ipsum")
If Trim(StrData) = vbNullString Then Exit Sub
StrFileName = App.Path & "Lorem Ipsum.txt"
WriteToFile StrData, StrFileName
Shell "C:Program FilesHHD SoftwareHex EditorHex Editor.exe " & _
Chr(34) & StrFileName & Chr(34), vbMaximizedFocus
End Sub
Public Sub WriteToFile(ByVal Text As String, _
ByVal FilePath As String)
Dim IntFile As Integer
IntFile = FreeFile
Open FilePath For Append As #IntFile
Print #IntFile, Text
Close #IntFile
End Sub
Plain evident I thought wrong. Thoughts? Perhaps I need a confirmation.
VB prints:
(1) ASCII
(2) Unicode
<Question Mark>/
TristateTrue For Unicode, TristateFalse For Ascii
I have tried to use FSO to write a text file in Unicode. I open the text file and save as a new, Unicode is the default-encoding. It succeeded.
TristateTrue for Unicode, TristateFalse for Ascii, but how about UFT-8 ??
Isn't unicode the same as UFT-8?
Unicode Char To Extended ASCII
i not sure whether i using the right header.
however i came across a website that is able to display some words that i believe to be arabic characters using "ãäÊíÈáíãÈáÊájhgjsfáÈÓÔí" using only a normal label..
i believe the same can be done with chinese characters.
but with the chinese characters, how do i do the reverse to achieve characters such as "ãäÊíÈ"
Thanks,
Ascii Ansi Unicode ??????ahhhhhhhh
I hope some one can help me understand how to tackle this problem.
I have a text file which I am trying to read and save to a DB.
While saving it I check to se if the lines meet certain criterias (by comparing to an existing list).
The problem now is that some of the files are written in French and have special characters.
I don't even know where to begin on this problem. The characters are visible if i open the file in DOS, but otherwise they are displayed incorrectly.
K, so what does this all mean???
The file is created in what format???
i am working in what format???
i want to save it and retrieve it in what format???
I know these are really broad questions but I am trying to understand.
ANy help, or suggestions would be awesome.
Ebcdic Ascii Hex Dec Oct Chr Binary Unicode
Recently, I am very interest in understanding more about these different formats:
ebcdic
ascii
hex
dec
oct
chr
Binary
Unicode
-Are there more?
-The ones that I have listed, what use do they have and when would you use it? I know some of them already.
-Why would you convert from one format to another?
I found this but really want to understand the correlations:
http://www.lookuptables.com/ebcdic_scancodes.php
I learned EBCDIC about 10 years ago but can't remember the purpose it serves for today.
Thank You
Sorting Data From An ASCII Text String And Saving It As Text File
Hi,
I'd first like to copy paste a section of my ASCII text string over here and then ask the question.Given below is the ASCII text string:
RT 01 A_UNIT
DEV 01 A_UNIT
=ontrol Mode ON LOCAL STAT
Occupied YES OCC
CCN Chiller START CHIL_S_S
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE
=
=?
RT 01 CIRCA_AN
DEV 01 CIRCA_AN
=IRCUIT A ANALOG VALUES
Percent Total Capacity 100 % CAPA_T
Percent Available Cap. 100 % CAPA_A
Circuit Running Current 185 AMPS A_CURR
Discharge Gas Temp - A2 122.9 dF DISTMPA2
Saturated Condensing Tmp 97.5 dF TMP_SCTA
Saturated Suction Temp 41.5 dF TMP_SSTA
EXV % Open 43 % EXV_A
Variable Head Press Pct. 0 % VHPA
=
=?
Given above is a portion of my ASCII text string.I'd like to know how to sort out the data from this file and copy it in the same format as given above into a new Text File,using the delimiting characters like the white space and the "?".The "?" indicates the end of the file and the following ASCII text string after every "?" indicates the start of a new text file.
I'd be very very grateful to the person who'd give me the solution to this.Thanking you in anticipation.
How To NOT Use Unicode When Putting Together A String (using Chr(ascii) Codes)
my guess is this is a unicode issue.
Heres what i want to do, split a file with delimiter chr(255) & chr(216).
My string contains the data..
GARBAGEDATA & chr(255) & chr(216) & IMPORTANTDATA & chr(255) & chr(217)
i then split the file again with delim chr 255 & 217...
now ive got IMPORTANTDATA isolated.
but how can i reput the chr(255) & 216 to the beginning of IMPORTANTDATA, and reput chr 255 and 217 to the end?
i tried..
Put #1, 1, Chr(255) & Chr(216) & ***2(1) & chr(255) & chr(217)
when saving but naturally it doesnt work (***2(1) is the importantdata)
when i looked at the file with a hex viewer.. theres these characters 0800 CD0A before the chr(255) & chr(217)
Key Press Event And Ascii Code In Unicode Environment
As part of internationalizing an existing VB application such that it supports Japanese, Korean, Chinese (i.e. all Unicode characters) not only English language.
The problem we are expecting is, in the current English version, we are having some key press events like
If KeyAscii = 64 Then
blnResult = False
'Do some thing here …
End If
Actually the above code takes the ASCII code (say character ‘A’) from the end user and doing some operation. How do we consider the same in Unicode version (i.e. in the Japanese version, the end user will enter his own character not ‘A’ as in this case)? Is there any standard methods/solutions are there while internationalizing an Application for these key press events? Please let me know.
Save File As Unicode Text
does anyone know how to save a file as unicode text. i tried vbunicode on each string i wanted to save but the program i wrote it for doesn't read it. so after i save my file i have to manually open in wordpad and save it as unicode text doc. if anyone has any ideas please let me know.
Create A UNICODE Text File....
Hi all !!
Does anybody knows how to create a text file in UNICODE ?
I´m using:
Open "file.txt" for Output as #1
Print #1, "Mytext"
Close #1
Help ?......
THANX.
How To Read Unicode Text File ?
Please help me, because I can't find an easy solution to (someone could think) very simple problem.
I have a file that has Polish and Russian (cyrylic) characters. This text file is in unicode format, so I can see the text using notepad.
I have to read line by line (in fact this is csv file) and put the data into access database. The problem is, that I get "??????????" instead of Russian cyrylic. I read te file and put the string to textbox, I set the the textbox font properties to "cyrylic", but I still get "?????????????". I went through many tips of how to do it, but I always get question marks.
Now I'm using more less the following code to read the file and to get text line:
Code:
sub ReadUnicodeFile(pathToFile as string)
Dim myFSO, f, ts
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set f = myFSO.GetFile(pathToFile)
Set ts = f.OpenAsTextStream(ForReading, _
TristateTrue)
'and now I put it into textbox to see the results
Do While Not ts.AtEndOfStream
Text1.Text = ts.ReadLine
msgbox "check what is in textbox" ' a moment to see magic question marks
loop
end sub
I woul really appreciate any help. I also attached my test file with cyrylic if someone would like to play with it.
Marcin
Accepting Unicode Characters In Unicode Compliant Text Box In Vb 6.0
I want to develop ActiveX control using text box control from frm20.dll. This text box control is unicode complinat. When I enter unicode charaters in this text from VB, it displays extended characters and not the actual characters. But if I read from a text file where unicode characters are written, there characters are displayed properly. Also if I pase unicode text string from other application such as Word, these characters are also displayed properly.
I need some help in writing unicode characters in the text box directly.
Aparna Tamanekar
Unicode Output To UTF-8 Text File Problem
I can use the FM20.DLL control inside VB6 and the application can view / edit / add Simplified Chinese. However, when I export the data to a text file ,some Simplified character turned to ? instead of a valid Simplified Chinese
Value stored in the SQL2000 database is
滁州市发生建市
When export to a notepad text file, it output as
滁州市?建市
I checked through the internet and the ADO data control 6.0 did support unicode and I think it is the problem when it output to the notepad which I use an array to hold the data, code as below
===================================================
Dim o_Container
Open "ABC.TXT" for output as #1
o_Container(1) = adoh.recordset.fields("SimplifiedCharacter")
print #1, o_Container(1)
Print #1, adoh.recordset.fields("SimplifiedCharacter")
Close #1
===================================================
'ABC.TXT contains
滁州市?建市
滁州市?建市
===================================================
Where adoh.recordset.fields("SimplifiedCharacter") did hold the correct value "滁州市发生建市"
Thanks in advance
Writing Unicode To Text File? [SOLVED]
Hi,
Those who have read my previous posts know I'm currently trying to get Unicode working in my application. So far I've had some decent success, but now I've come across another problem.
There are a few places in my app where I use the Print # Statement to write to a text file. Unfortunately it seems this method does not support Unicode!
Is there a way I can write a text file in Unicode from within VB6?
Thanks in advance.
Edited by - SeanR on 5/8/2005 9:12:46 PM
Opening And Writing To A Text File In Unicode (VB6) - Possible?
Hi,
I've written a program in Visual Basic 6 that loops through a list of words and writes them to a text file as the basis for a vocabulary learning game. However, I'm having problems with special accented characters like ä, é and so on, which are creating some strange results in the output file. They appear fine in the listbox.
I know this has something to do with Visual Basic 6 handling strings internally with Unicode, yet only writing to a file in the ANSI format. Is there any way to open a file for writing as UTF-8 or Unicode, or a way round this problem?
Hope someone can help - thanks!
Rich
URGENT - How To Change The Display Mode (ascii, Ansi, Unicode, Etc) In A TextBox?
Hi,
I wrote a VB program to communicate with a microcontroller (AT89C51) through RS232 port (COM1). When the program sent a character 'p', the microcontroller responded by sending a string, which formed by a character arrays, to PC byte-by-byte as follows:
'p', '5', '2', ',', '3', '6', '0', '
', ' ', 'o', 'k', '
', ' ', '>', 'p', '5', '2', ',', '3', '6', '0', '
', ' ', 'o', 'k', '
', ' ', '>'
...which is equivalent to "p52,36,0
ok
>p52,36,0
ok
>"
note:
'
' = carriage return (CR)
' ' = space
The program displayed the received string using a TextBox control. The string was not displayed properly as expected. The displayed string was copied and pasted into NOTEPAD (ANSI, UNICODE), Ultraedit (ASCII, UNICODE). Hyperterminal (Windows XP Pro) was also used to display the string sent from microcontroller.
String displayed in TextBox control:
p52,36,0 ok >p52,36,0 ok >
String displayed in Hyperterminal:
p52,36,37
ok
>p52,36,37
ok
>
String copied to Notepad (saved as ANSI):
p52,36,0 ok >p52,36,0 ok >
String copied to Notepad (saved as UNICODE):
p52,36,0 ok >p52,36,0 ok >
String copied to Ultraedit (saved as ASCII):
p52,36,0
? ok
? >p52,36,0
? ok
? >
String copied to Ultraedit (saved as UNICODE):
p52,36,0
ok
>p52,36,0
ok
>
Summaries
[1] Displays shown in the VB program and Hyperterminal are DIFFERENT. The carriage-returns (CRs) are ignored in TextBox control.
[2] Displays of pasted string in both Notepad (ANSI) and Notepad (UNICODE) are SAME.
[3] Displays of pasted string in Ultraedit (ASCII) and Ultraedit (UNICODE) are DIFFERENT. The CRs in string pasted in Ultraedit (ASCII) are replaced by '?'.
[4] Displays of pasted string in Notepad (UNICODE) and Ultraedit (UNICODE) are DIFFERENT even though both are saved as UNICODE mode.
Questions
[1] Why CRs are ignored in VB TextBox control?
[2] Why texts shown in UNICODE mode in different softwares, e.g. Notepad and Ultraedit, are DIFFERENT?
[3] Please advise how to make the received string shown in TextBox control to be SIMILAR to that of Hyperterminal.
[4] What are the differences among ANSI, UNICODE and ASCII text?
I used the following code to display the received string to TextBox or txtReceive:
Code:
Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
txtReceive.Text = txtReceive.Text + MSComm1.Input
End If
End Sub
Thank you very much!
TQvM
URGENT - How To Change The Display Mode (ascii, Ansi, Unicode, Etc) In A TextBox?
Hi,
I wrote a VB program to communicate with a microcontroller (AT89C51) through RS232 port (COM1). When the program sent a character 'p', the microcontroller responded by sending a string, which formed by a character arrays, to PC byte-by-byte as follows:
'p', '5', '2', ',', '3', '6', '0', '
', ' ', 'o', 'k', '
', ' ', '>', 'p', '5', '2', ',', '3', '6', '0', '
', ' ', 'o', 'k', '
', ' ', '>'
...which is equivalent to "p52,36,0
ok
>p52,36,0
ok
>"
note:
'
' = carriage return (CR)
' ' = space
The program displayed the received string using a TextBox control. The string was not displayed properly as expected. The displayed string was copied and pasted into NOTEPAD (ANSI, UNICODE), Ultraedit (ASCII, UNICODE). Hyperterminal (Windows XP Pro) was also used to display the string sent from microcontroller.
String displayed in TextBox control:
p52,36,0 ok >p52,36,0 ok >
String displayed in Hyperterminal:
p52,36,37
ok
>p52,36,37
ok
>
String copied to Notepad (saved as ANSI):
p52,36,0 ok >p52,36,0 ok >
String copied to Notepad (saved as UNICODE):
p52,36,0 ok >p52,36,0 ok >
String copied to Ultraedit (saved as ASCII):
p52,36,0
? ok
? >p52,36,0
? ok
? >
String copied to Ultraedit (saved as UNICODE):
p52,36,0
ok
>p52,36,0
ok
>
Summaries
[1] Displays shown in the VB program and Hyperterminal are DIFFERENT. The carriage-returns (CRs) are ignored in TextBox control.
[2] Displays of pasted string in both Notepad (ANSI) and Notepad (UNICODE) are SAME.
[3] Displays of pasted string in Ultraedit (ASCII) and Ultraedit (UNICODE) are DIFFERENT. The CRs in string pasted in Ultraedit (ASCII) are replaced by '?'.
[4] Displays of pasted string in Notepad (UNICODE) and Ultraedit (UNICODE) are DIFFERENT even though both are saved as UNICODE mode.
Questions
[1] Why CRs are ignored in VB TextBox control?
[2] Why texts shown in UNICODE mode in different softwares, e.g. Notepad and Ultraedit, are DIFFERENT?
[3] Please advise how to make the received string shown in TextBox control to be SIMILAR to that of Hyperterminal.
[4] What are the differences among ANSI, UNICODE and ASCII text?
I used the following code to display the received string to TextBox or txtReceive:
[VB]
Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
txtReceive.Text = txtReceive.Text + MSComm1.Input
End If
End Sub
[/VB]
Thank you very much!
TQvM
Text File Coversion From ASCII To UTF 8
Hi,
I am writing a program to create text files. I want to get the text file in UTF 8 format. Can anyone of you share the script how to auto covert the file format from ASCII to UTF8 when creating the text file.
When i try it out, it only conver to unicode. NOT UTF 8.
Thanks & Cheers
Blue_Thunder
How To Tell If A File Is Ascii Text Format
Hello,
I am making a simple file viewing demo, which will display the contents of a text file in a multi-line textbox from a file selected in a directory listing. I only want to open the file if it is in "plain text" format - so files like .txt, HTML files, VB files like .frm, .vbp, and .cls would qualify but .frx would not; .exe, .xls. etc. would be excluded as well. (In the case where a non-text or binary file was selected, the multiline textbox would simply display "File is not in text format" or something to that effect.)
Without relying on the file extension, is there a way to test the file to say with reasonable certainty that it qualifies as a "plain text" file? I'd appreciate your thoughts ...
Reading From A Ascii Text File
Hello, i'm trying to read a ascii text file using the streamreader.
For simplicity, let's say my .txt file contains the following data:
a
b
c
d
e
f
g
How would i read from, let's say the first occurence of character "c" to "f"?
In pseudocode, i would be something like:
for starting charcter = "c" to 3
It would read 3 lines after "c", up to "f", and give me:
c
d
e
f
I would appreciate your help!
Records 1000K From Ascii Text File
Hi,
How to retrieve data from ascii text file which is having 1,000,000 lines or records and store data at a stretch directly in Oracle using Client to Server.
Captain
Read Only Last Line Of Text/ascii File
Hi Guys,
I needed some help regarding file reading in VB 6. I am writing a program that needs to insert a record in a text file. The text file has following format..
Date, Time, Open Price, Close price
Now i need to insert record only if date is greater than last date in file.
So everytime I need to insert record, I have to open file and read sequentially and then I reach last record. This takes time.
IS there a way to read such file in binary or whatever so that i can get last record straight away or very quickly without going thru all records one by one.
If there is can anyone post a small code.
[Records in the (text) file is like -
01/01/2006, 1100, 123.33, 155.55
01/01/2006, 1130, 122.22, 134.33
01/01/2006, 1200, 112.22, 124.33
so on ... ]
Thanks a lot,
Cheers,
GR
Convert Unicode Data????
Hi everyone :
Currently I am developing a system for a Taiwan Company. The company also have base in China. I got a problem here. Taiwan and China uses different version of chinese (Simplify Vs Traditional). The problem is, the client request me that any data enter in Taiwan (traditional) need to be able to read by branch in China(Simplify). I wonder if I use the same convertion (BIG5) then only change the regional setting in Windows XP Pro. to either Taiwan or China will help? Anyone have any working experience on unicode programming with VB6?
* I am using SQL Server 2000 Personal Edition as SQL Server 2000 Ent. would not install on Windows XP Pro *
Appreciate for any respond regarding this topic.
Convert Unicode To Hexadecimal
i have unicode characters stored in database.acutally these are arabic language messages.now i want to convert them into hexadecimal.can anyboy help me?
How To Convert String With E.g. +AWE- In It (unicode)
Hi,
I have a string with e.g. 'Du+AWE-an', this should be 'Dušan'.
though +AWE- = š.
(for a table see e.g. http://homepages.tversu.ru/~ips/unicodetest.htm)
How can I convert a string with special characters from e.g. 'Du+AWE-an' to 'Dušan'?
Well the WS represents the š, but how to compute it?
Do I need a lookup table or can I do a generic way, to cover all latin Latin Extended-A, Greek and cyrillic characters?
thanks & Regards,
Christoph
Column Aligning Text Ascii Output File
Code:
For i = 0 To numMeas - 1 Step 1
Print #FileNumber, measurement(i).name, measurement(i).hexID, measurement(i).lDecimalID, measurement(i).sDecimalID
Next i
I am writing data to a text ascii file. This output file will be used as a report. I want the columns to be aligned correctly. Problem is, if the text in the first column is too long (over 13 chars) an extra tab is put in, which makes the data not align properly. Can anyone help me out, on the best way to format my output to text ascii file? vr, Xeifrank
Life is one big IF/ESLE statement
How To Convert Chinese Character To Unicode Hex
Yes, I have been trying and looking on the web for the answer, plus search this forum, but seems like none answer my question.
I was able to make a Vb program that is half useful in this, why i say half useful, well, when i convert a character , let's say "n", it is converted to hex "6E", but actually, i need it in the form of
"00 6E", i found out that for every alphabet, i can just append a "00" in front (but that's not practical), but when I convert chinese character, the result is not accurate. I think I have miss something there.
I found Javasript that does just that. It produces accurate result, and I try to reproduce that in Vb but failed. Please help.
* I have no professional training in singing and vb
Attached is a simple vb program, that takes an input from text1, and output the result to text2.
And a javascript that are able to convert the character to the form I needed. Please help.
Lastly, Hi to all the ppl and Moderators Cimperiali an Cakkie.
Convert .wav To ASCII
Hi,
I would like to convert a file in wav format into txt format, so to obtain a vector of numbers to create a graphic, with a program, like excel, that is not Matlab.
Exactly I've an algorithm in Visual Basic that analyses a vector of points (graphic) and then gives me in output a series of parameters.
In matlab this is easy, because it recognizes wav files but if I would like to do the same thing in Ms Access, I've to convert before, the wav file in txt file so that my algorithm in Visual Basic can analyse it.
Anyone knows if there exist some algorithm or code that convert wav files in ASCII text files?
Thanks
Bernd
|