Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

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.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How I Can Convert UTF8 String To ASCII
I read string from file. This string in UTF8 format. I need ASCII symbol. Function strconv() convertino only 16 bit unicod. For .NET i can use system.text class, but in excel VBA i don't use this class. Help, please.

Convert Ascii To Text
i can convert text to ascii using asc(), but how do i reverse it?

Convert Text File To Ascii
Does anyone have some code out there that will convert a text file to an ascii file????

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?

UTF8 Text Boxes
I maintain a user data management tool that is written in VB6. This is an application that is starting to be used worldwide and so needs to support multiple character sets using UTF8. I have asked a few dev collegues of mine and they all say it needs to be ported to .Net but I am not sure this really is an option due the where the program has to sit. So if anyone has some suggestions to try and get text boxes to support UTF8 characters it would be great.

The Mav

Help With Converting (UTF8, Hex, ASCII)
Hi, I'm not exactly sure whats wrong with the following code, but I have been trying for a bit now to get the syntax correct. The error I get is an "expected array" error if that is of any help. I have a frmConvert that has a txtbox and a lstbox. The user places the text they wish to convert in the txtbox and selects the conversion (e.g. - UTF8, Hex, or ASCII) and hits a cmdConvert button which should display the converted text back into the txtbox. Here is the code below.

private Sub cmdConvert_Click()
on error GoTo ConvFailed
If txtConv.Text = "" then
Exit Sub
End If
If lstType.ListIndex = 0 then txtConv.Text = Converting(0).ToHex(1, 0, txtConv.Text, 0)
If lstType.ListIndex = 1 then txtConv.Text = Converting(0).ToUTF8(1, 0, txtConv.Text, 0)
If lstType.ListIndex = 2 then txtConv.Text = Converting(0).ToASCII(1, 0, txtConv.Text, 0)
MsgBox "Conversion Failed"
End Sub

public Sub Form_Load()
lstType.AddItem "=> Hex"
lstType.AddItem "=> UTF8"
lstType.AddItem "=> Regular(ascii)"
End Sub

If there is any more required code that you may need from me to understand my situation better, then just reply stating what it is you need. I would greatly appriciate any help you can give. I believe the error is in the syntax of "Then txtConv.Text = Converting(0).ToHex(1, 0, txtConv.Text, 0)". Thanks in advance for all your thoughts/suggestions/help.


Save String As Text File (with UTF8 Encoding)
Hi fellow programmers,

I have a string, that I need to save in a text file that needs to be encoded with UTF8. But I don't know hot do do this?

Best regards

Morten Scheibye

Sorting Data From An ASCII Text String And Saving It As Text File
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:


=ontrol Mode ON LOCAL STAT
Occupied YES OCC
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE

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.

Convert Rich Text To Plain Text Without Using Rtf Component
Greetings all!

Here's my problem:

I have some text that is saved in a database and it is in RTF format.
But now, what I need to do is convert all this into normal, plain, and boering old text...

So anyway, is there a way to convert RTRF into plain text without using the Rich TextBox Control?

Thank you all, and have a good day!

Converting Text Into Ascii Text
ok, i have just started VB and i have evrything done on m project exept for one thing. Its a prog where u enter text into one text box, and when u press "translate" it comes up ans ascii text in another text box, what would that code be? i have been looking EVERYWHERE and hoping that this is the right place, PLEASE email me: EMAIL ME PLEASE!

Using A RTB: How To Convert RTF Text Into Plain Text During Run Time??
My Werdpad text editor, I want to add a feature I can't seem to figure out how to do.

With a new file I "paste" a bunch of text from something... it's all formatted nice and pretty in rich text. Tables, Bold...etc.

What I want is by selecting an option from the menu to take what is displayed and reformat it to plain text (as if I pasted it into notepad) getting rid of all the formatting (including table cells if there are any).

I know how to set the font using SelStart=1 and SelLength = Len(RTB.Text)
But I don't know how to get rid of tables and pictures....

Any idea's is appreciated.


Edit: Here is all I have. This sets the font. But that's all I have

Private Sub mnuPlain_Click()
Text1.SelStart = 1
Text1.SelLength = Len(Text1.Text)
Text1.SelFontName = "Verdana"
Text1.SelFontSize = 10
Text1.SelBold = False
Text1.SelItalic = False
Text1.SelUnderline = False
Text1.SelStrikeThru = False
Text1.SelColor = 0
Text1.SelStart = Len(Text1.Text)
End Sub
Yes, my RTB is called Text1 I am just used to that name for a text box.

Convert HTML Text To Rich Text Box
I want to display html content in an Rich text box. Please help...

I has only <font>, <br>, <b>, <i> <u> htnl tags

Convert HTML Text To Regular Text..Please Help
Okay, I have the logs of AIM Conversations [ I'm making an AIM Logger], and I would like for the logs to be plain text - But the AIM Window has them as HTML, How do I take all the HTML Out And just have it plain, so its nice and plain in notepad? MUCH thanks

Convert Binary Text To Regular Text
How do you convert a binery text to a regular text?

Is There Any Wany To Save ASCII Text File Into UNICODE Text File Thru VB6?
Hi there,

I have a text file in ASCII and I want to save this text file as UNICODE text file thru VB6. Is this possible from VB6, if so, please help me how to do this?

thanks in advance.

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

Want To Convert Text In Text Boxes To Normal (without Text Boxes)
Hi all,

Our Client is sending files in RTF Document format which has some content. Each and every word in that document is in its own text boxes (i.e., the RTF has full of text; each and every word is in own text box). I need to convert it to normal word document without text boxes. But my problem is the entire content of that file is coming in text boxes. so it is very difficult to convert it to normal word document (without text boxes).

Currently I have two choices to do that: one is select the text box and copy the content and paste it in a new file. but all formatting is lost. i have to do all formatting manually. The second option is convert it to PDF and do a conversion and check alignments give some missing formatting etc.

These cases are ok if I got a file with full of text paragraphs. but most of the time I am getting tables. That time these ways are not smart way to do that.

Is there any other way to convert that file to normal word document. Pls let me know.

Currently I used to convert that document to Adobe PDF and will do a PDF conversion and then I will do a formatting as per the RTF document.

So, it is taking to much of time consuming and effort.

Is there any solution for this?



Ascii To Text
i didnt want to clutter the board and since this question relates i just posted it here. ok well here is where im at. im trying to convert the ascii code back to text. here is how i have it set up.5 text boxes and 2 command boxes the first text box is where the user imputs their message the user presses command button number 1 and that converts text to ascii and posts the ascii in text box 2this is easy no problem now the third text box i call the shifter because it takes what ever number they imput in it and that shifts the ascii up or down that many times also no problem as of now now when the user presses command box number 2 it is suppose to take the shifter and shift the ascii code that many times over which it does and then it is suppose to convert the newly made shifted ascii code back to a new text. example user enters hi converts to ascii 104 05 then user enters +1 for the shift presses convert to text in text box 4 it says 105106 and the new word says "ij" because thats the shift. again my probelm is the changing 105106 to ij im gonna post my whole code so far everything works sept for the bottom

Private Sub Command1_Click()
Dim c
c = ""
If Len(Text1.Text) = 0 Then Exit Sub
For b = 1 To Len(Text1.Text)
c = c & Asc(Mid(Text1.Text, b))

Text2.Text = c
End Sub

Private Sub Command2_Click()
If (Text1.Text) = "" Then
MsgBox "enter your message to be converted then press convert to ascii", , "woops"
Exit Sub
End If
d = ""
c = ""
For b = 1 To Len(Text1.Text)
If Text2.Text = "" Then
MsgBox "first enter a message to be converted then press convert to ascii"
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "enter a number value that you will use to shift the ascii", , "error"
Exit Sub
End If
c = c & Asc(Mid(Text1.Text, b)) + Text3.Text
Text4.Text = c ' everything beyond this point doesnt work
For b = 1 To Chr$(Text4.Text)
d = d & Chr$(Mid(Text4.Text, b))
Text5.Text = d
End Sub

Get Text Above ASCII
I have made an application which retrieves all entries in the Favorites folder. Using Windows 2000 SP4 and Microsoft Internet Explorer 6. One of the entries is:

Венгерский танец

But it is coming out

??????????? ??????

in my application using VB 6. I am trying to put this in a database but text ?????????? ?????? is no good. Any ideas how I can get the text correctly in the access database? Thanks.

Ascii To Text How ?
Hi guys , there's any way to convert Ascii to text ?

thanks for reply

Ascii Text
I would need a

control for displaying and editing ascii text like in or other console apps.

or if not then

code for converting between ascii text and some sort of text with escape characters representing those characters the textbox control doesn't display lik e vbnullchar and vbcrlf, vbtab and so on.

or if not then

a list of the characters that doesn't display in a textbox

Ascii Only In Text Box
Ok, I want to type letters and numbers on the key board and
have the ascii code come up in the text box, instead of text.
This is as close as I can get:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & KeyAscii
End Sub
The "Text1.Text & KeyAscii" was just to get sequential characters in the text box.
Notice that:
mike becomes, ekim109105107101

Three problems:
1) If I type the word "mike", it comes out backwards(ascii included).
2) I only want ascii not letters and not in reverse order.
3) Things get worse when I try to use the "enter" key.

If you create a simple textbox and cut and past the above code, you will see exactly what I mean.

Thank's for any help!

Text To Ascii
I am new to vb and am looking for a text to ASCII
conversion program. I need to send ASCII characters
out the comm port and I have to send the start and end
transmission characters along with the data
thanks for any help

Ascii Value Converted To Text
how do you make a Textbox show the value of an Ascii value? ... i want it to display a " (ascii 34)

it checks if it doesn't end with a " after the lost focus and then it places it there but i can't say Text1.text = Text1.text & """

i've had similar problems like this so please don't give me me alternatives

elbow deep within the boarder line. show me that you love me and that we belong together.

ASCII Text Header
Is this header a fixed or variable length header? Meaning:

Will byte 80 always have the value you want?
Take BITPIX for example. If 16 / 16 = 1 Then Len(BITPIX) = 1, but if 16 / 1 = 16 Then Len(BITPIX) = 2

Is NAXIS1 always going to be where you expect it? Or will it vary depending on the information in the header, much like the ID3 frames in an MP3 file?

What Are These Ascii Values As Text?
What is Asc(5)?
What is Asc(12)?

These codes are used as an end of transmission code with the data I am using and I need to know what they actually are.

Text -&gt; ASCII Graphics

I was looking around and found some useful progs for text->ascii gfx, i.e. from I to
etc., I was wondering how could I do this in vb, I mean how can I get the build/shape of a letter?

Thanks in advance!

Ascii Text Compression
Anyone know of a way of compressing a load of text, without the resulting 'data' containing any CR/LFs ?

The reason I ask is because I want to include a large amount of data in an app im making, (about 600K), and I dont want to put the data into a file.

So I wanted to hardcode the compressed the data into the app, and then have it decompress the data at runtime.

Any ideas ?

- jamie

Putting ASCII Characters Into A Text Box.
I'm working on a program that when I press a button, ASCII character 11 and the number 1 should enter the text box. But I don't know how to add the ASCII character.

Converting From Ascii To Plain Text

I wanted to make a program that would translate for example 13 to a Return. But it doesn't seem possible.

Lets say i translate 3 enters into ascii = 131313 . Then how will i know i the chars where ment to be 131 3 13 or 1 32 32 3 ? Is it possible to create a converter that way, without using somekind of decimiter.

Text File Coversion From ASCII To UTF 8

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


How To Tell If A File Is Ascii Text Format
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 ASCII Text Files
How do I open an ASCII text file and read it line-by line into string variables?

Sorry, I'm a programming virgin.


ASCII To ISCII Text Conversion
Hello Experts,

I am working on a project where name & address in english
must be converted to NUDI Kannada font text.
But in Nudi there is API to convert from ISCII to Nudi Bilingual format. Can any one tell me how to convert ascii to iscii text format.

ASCII -&gt; Text And Visa Versa
Is there anyway that I can get VB to convert ASCII numbers to single character strings and back again? I need it for doing v. basic encryption of high scores.


Ascii Text To Access Database
i need a code snippet to read an ASCII text file delineated by | (pipe sign) and transfer the data to an Access Database

The data i have, some are delineated by space, some by pipe sign i.e |

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:
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:

I would appreciate your help!

Unix Ascii Text Importing
I am trying to import an ascii text files that is created on a Unix machine. I was wondering if anyone knows how to deal with these file types. The problem that I am having is with the Unix text file because it only end with a carriage return and not with a carriage return and Line Feed. I have tried searching for the carriage return in the file chr(13) but it will not find it.

If anyone has had luck dealing with this in the past any help would be appreciated.

Thanks in advance

Sean Gearin

Ascii Character Set Functions In Text Boxes

I am trying to edit some text in a text box by using the ascii codes for the editing functions i.e. chr(8) for delete etc, at the moment when i write the following:

textbox.text = textbox.text & chr(8)

instead of deleting the last character a black rectangle appears, which i guess means the the command is being written as its character rather than its function.

How can i get over this problem??

ps i also want to use the controls for tab, shift, shift lock and the other general keyboard function keys.

How To Make A Text Box Display Ascii Character
i have a text box that receives the ascii character's sent by a server but it only receives the first ascii character and the others are not displayed to make it display the total ascii character sent by the server ???

Replace Text With Full ASCII Code?
does anyone have that code that will replace everything in data.txt with it's ASCII code? or a function that will do it? Something like this:

Private Function ASCII(data As String) As String
data = Replace(data, ">", "%3E")
data = Replace(data, "`", "%60")
data = Replace(data, "{", "%7B")
data = Replace(data, "|", "%7C")
data = Replace(data, "}", "%7D")
data = Replace(data, "~", "%7E")
data = Replace(data, ":", "%3A")
data = Replace(data, ";", "%3B")
data = Replace(data, "<", "%3C")
data = Replace(data, "=", "%3D")
data = Replace(data, Chr(34), "%22")
PostASCII = data
End Function

I dont think i can find all the ascii. does anyone have it done already?

Printing The Ascii Code Of A String Into A Text Box.
Hi all,

I need a code that will do as the title suggests, take a string, letter by letter, and print out the ascii code to a text box of each letter. I have not used Visual Basic for quite some time, and remember learning how to do this, but forgot how.

Thanks in advance.

Replacing Text In Open Ascii File
What is the comand to replace text in an open ascii file? Please help.

Records 1000K From Ascii Text File

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.


Limiting The Number Of A Particular Ascii Character In A Text Box?

Can anyone tell me how I can limit the number of times that an Ascii character can occur in a text box?

Thanks, Bruce

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,


How To Convert &"TEXT&" To TEXT? Remove The Quotations?
I have a text file that I load into a list box(seems easier to search and use index to reference items in list).

It starts out like this:

begin general_information
&nbsp name "Example"
&nbsp designer "Steve McNally"

I need to get rid of the quotation marks from both sides of the word "Example" and "Steve McNally".
I can get rid of the mark on the left with Mid (String)

txtName = Mid(List2.List(1), 9) wich produces: Example"
txtDesigner = Mid(List2.List(2), 13) &nbspproduces: Steve McNally"

I've tried mixing the Mid function with the Left and the Right functions, but get odd results like: ample""Ex

Then, I'm going to print it back to a text file, but I'll be able to Print the " " back around them no problem.

I'd appreciate any help. I'm still kind of a novice so, if you could just paste some code please.


Printing To A DOTMATRIX Printer In ASCII Text Format
OS : Windows 9X
Platform : Visual Studio 6, Environment : VB6
Printer : Epson Compatible 80 Col, 9 Pins

I want to send data to printer using VB Code without using Printer Object.
i have tried following tricks :
Ist Method :
1. Create a Text file containing text to print.
2. Send the text file to printer using Shell( ) Command.
Copy <TextFile> to <LPT1>

II Method similer to first.
Private Sub PrintToPort(FName As String, Optional LPT As String = "LPT1")
Open FName For Input As #1
Open LPT For Output As #2
StrToPrint = ""
While Not EOF(1)
Line Input #1, StrToPrint
' StrToPrint = StrToPrint
Print #2, StrToPrint

Close #2
Close #1
End Sub

I know this is not proper method to print a file. Any alternate to do the job ?

Need Help Sending ASCII Characters (text :p ) As Keystrokes To A Game
Hmm it's been almost 24 hours and my original post only got 4 views and no reply on the API forum, soooo I decided to give you a link here (there's no point in copying the whole post, right?). The thread is this one:

Please, at least read a bit of it and if you have ANY idea, tell me! I need an easy way to convert ASCII characters to key codes (I don't wanna have to go through each one of the 256 characters and try to guess what is the corresponding key code)...

Copyright 2005-08, All rights reserved