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

Finding Non-printable ASCII Characters Within A String.

As the title states, I'm trying to find characters within a string that are non printable, meaning they won't be displayed within a textbox (or in notepad for that matter). Is there any fast way to check for these characters? I know i could do a Instr using ranges Ascii ranges, but that seems to take to much time. Any suggestions?!

This is what's happening in my code:

Get #1, , S

For i = 0 to 19
If InStr(1, S, Chr$(i)) > 0 Then MsgBox "Found Null"

For i = 169 to 255
If InStr(1, S, Chr$(i)) > 0 Then MsgBox "Found Null"

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Display Non-printable ASCII Characters
I am trying to display ASCII characters in a label, and those ASCII characters may not neccesarily fall into the range of printable characters. In other words, my form has a combo-box that lets the user pick any number between 1 and 255, and I will then display what the CHR(cboNumber.text) value LOOKS LIKE in a standard DOS screen. This works fine if the value is above 32 and below 127, but I ALSO want to display what the other characters look like as well as viewed in the DOS edit screen (THUS a chr(28) looks like an L on it's back etc.) I have found that I can change the characterset "charset" to 255, but that only works IF THE FONT SUPPORTS that character set, and after a dozen fonts, I may be on a wild goose chase. Any ideas!

String Constants & Non-Printable Characters
Is it possible to define a string constant that contains non-printable characters?

For instance, what I really want to do is write:

Private const myconstant As String = "A" & Chr(9) & "B"

i.e. to include a tab character

Is this posible?

Encrypt String But Output Only Printable Characters
Have been struggling with this for a while now.
I need to be able to encrypt a string in a very simple way - BUT the output string must use physical characters, not things like carriage returns or non breaking spaces etc.
So an example would be:

Input string = "SHEEP"

Encrypted Output string = "^%Gh+"

Basically in Unicode you cant use any characters from 0-32 and from 127-160 as these are either unused or special character codes to do carriage returns or whatever.

Any code examples would really help me out so much!


Edited by - earnshaw1943 on 3/29/2005 5:55:45 AM

How To Check If A String Has All ASCII Characters?
How to check if a string has all ASCII characters?
I need a function that will take a string and look in it and see if it is all Asii (return TRUE) and if it is has one or more Non-ascii characters then return false.

How can I do this for a VEY VERY VERY Long string??? I don't want to go through the characters ONE by ONE! Is there a faster way???

Thank you Any help will do

How To Get ASCII Characters Of String [Thanks For The Help RESOLVED]
Lately I've decided to make a program that will use databases & stuff like that, but I wan to encrypt all of my data. I will test to figure out the datatype, then I will encrypt it if it is numeric or encrypt a string by using its ASCII codes. I can figure out how to do everything, including decrypting it, I just need to know how to convert a string to its ASCII codes. Don't worry about the decrypting, finding out the datatype that is, I've got things in mind. Just please tell me what the function is to convert a string or even just a single character to its ASCII codes.

Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.


Edited by - byufan on 1/5/2005 5:01:58 PM

*solved*add Ascii Characters Up To Form A String..
Hi there..

How can i make a string from ascii codes?
Dim Wad as String

Wad = (ascii 234 + ascii 128 + ...etc..)

msgbox Wad

any ideas?

Todays random quote: I am still determined to be cheerful and happy, in whatever situation I may be; for I have also learned from experience that the greater part of our happiness or misery depends upon our dispositions, and not upon our circumstances.

Martha Washington (1732 - 1802)

Edited by - Hopeless on 10/14/2005 8:31:49 PM

Finding ASCII Values In A STRING Variable
Hi all,
   I'm pulling some data from the active user list table using the openschema function to enumerate the active user list.  For example I'm trying to take each entry for 'login_name' and drop it to a text file.  The problem is this: I'm trying to create a modified string that includes data from the openschema method with some other data - but when I write the line it adds line-feeds for each reference from the openschema function - THEN - when I do a len(.fields("login_name") it reports a length of 32 even though the visible result is only 'Admin'... there must be some additional characters appended to the end of the string - but my string manipulation skills in VBA are pretty thin.  Can anyone help me decipher this?  Code snip follows at the bottom.

set rst1 = cnn1.openschema(adschemaproviderspecific, , _
  with rst1
     do until .EOF
      str3 = .Fields("login_name")
      msgbox str3
        rem note: will show 'admin'
      msgbox len(Str3)
        rem note: will show 32
      str1 = date & ":" & .fields("login_name") & _
      print #1, str1

  end with

NOTE: results of the print command will be as follows:

03/04/2004 : Admin

I'm trying to get the result to look like this:

03/04/2003 : Admin  chris

Finding Characters In A String
how do i know how many "." there is in "" using vb coding?

Finding Duplicate Characters In A String
In VB 6.0 I have a 75 character input text box. After the user enters the text I need to check for duplicate characters.
What is the best and fastest way to check for duplicate characters in a string?
I will have to take the 1st character entered and check it against characters 2 75, then take the 2nd character check it against char 1, skip 2, check 3 - 75
Should I use a for loop with MID and skip over the character I am checking using len?
What would you pros do? Thanks in advance for the help.

Finding Invalid Characters In A String
hiya Guys

For some reason, I can't for the life of me work out how to check for certain characters in a string.

I have to check the email addresses that i'm storing, only have letters or numbers (and an @ symbol).
So far I am looping through each character, and I need to check that each character is valid.

I thought that I could use something like [0-9], but that doesn't seem to work.
Any ideas?


Non Printable Characters
I am having a problem with strrings displayed in a multiline textbox.

I hava a application that processs string that are delimited by the file separator character Chr$(28) and displays the string in a text box.

The problem is, on one pc the string is displayed ok, but on another pc the string is displays with little squares where the file separators are.

Can anyone help solve this problem without removing the file separators?

Finding Multiple Occurances Of Characters In A String
I'm trying to make a Hangman program for a project, and there are two main things that are stumping me so far. The first I'll have another go at and retreat back to the boards if it beats me

As for the second, I'm using this code to check if a letter is in the word they have to find:

strGuessL = frmGame.txtGuessL.Text 'Put the pleyers' guess into a variable
intAnswer = InStr(strTarget, strGuessL) 'Check if the answer is in the string

If intAnswer = "" Then 'If the answer box is blank, then..
frmGame.txtGuessL = "" 'Clear it (just to make sure) and
frmGame.txtGuessL.SetFocus 'Re-set the focus
ElseIf intAnswer <> 0 Then 'If there's something in it, and it's correct,
blnCorrect = True 'Set blnCorrect to true
Else: blnCorrect = False 'Otherwise, make it false
End If

The target word is in strTarget, strGuessL is where the letter that the person guessed is stored.

This works ok at the moment, but the problem is: When there is more than occurance of the letter in the string, how do I tell that?

E.g, in the word 'Soccer', there are two c's. How do I tell the user "There are two c's" as opposed to "There's at least one c"?.

Any help would be awesome

Stripping Out Non-printable Characters
I am trying to support a VB 6 application for the first time in a long time and need some quick help to strip all non printable characters out of a variable. For example VbCr, VbLf, VbCrLf, etc.

Any ideas will be greatly received. I think it is just the Friday afternoon syndrome kicking in.

Identifying Printable Characters...
Is there any builtin function to know whether a string contains non-printable characters???? If not how would one check for this?

Reading Non Printable Characters
I'm reading in a huge(88Mbytes) ascii text data file.
I need to grab the data line that follows any "greater than"
character >

there are 10,000 greater than signs in this file, my code doesn't
find any.

I'm testing for it as follows
If (DATA_ARRAY1(datidx) = ">") Then

When I look at DATA_ARRAY1(datidx) in the watch window or hover
the mouse pointer over it, there are three squares in front of
the > I assume they are tabs. Any clues on how I can get
around these non printable characters getting in the way of
testing for the >



En/De-cryption And Non-printable Characters
I have a little bit of a sticky situation here, so if I don't manage to give all the information, please understand that I'm constricted by security considerations.

I have a fairly simple encryption function which works on incrementation and transposition, and I'm currently writing a decryption function. The thing is, my decryption function works fine with one exception.

Where the word to be encrypted is shorter than 8 characters, a keyboard character is added (same one every time).

If the word is < 3 characters, we get to the exception (ie where my function logics itself to death).

For example, say the word to be encrypted is "a" - it gets filled with ~ to become ~~~~~~~a. When this is encrypted, we have 2 non-printable characters (chr127), which I see as a square in VB, but when printed to the textbox, they appear as |

This is where my problem comes in....if I attempt to decrypt this, I end up with {{a - in other words, I have no way of detecting whether the user has correctly entered the characters or not. I'm thinking that if I check for non-printable characters, and hard code any of them back to a ~, I might get the result I'm after.... can you tell if a character in a string is a non-printable character or not?

Help!! Displaying Non Printable Characters In VB6 Rich Text Box
I want to display a string that has Carriage Return Chr(13) and Chr(11) in
a Rich Text box similar to what I would see in a Text box Text1.

Both have MULTILINE set to False and thats how I would need to use. i.e. basically displaying a long string that can be horizontally scrolled

The Rich Text box tends to show only partial text, truncating at the point where it encounters non printable character...

whereas the Textbox shows the entire text as is with the non-printable characters being substituted by a "pipe like character".

Would appreciate any helpsample code to fix this problem.

strText ="abc" & Chr(13) & "def" & Chr(11) & "ghi"

'display in a Rich Text Box
RichTextBox1.Text = strText

' display in text box
Text1.Text = strText

In RichTextBox1

In TextBox1

How Can You Convert URL Characters To Ascii Characters? (ie %2F = /, %3A = :, Etc)
Anyone have a function that can take a string and return its normal characters?

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)?


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.


Ascii To Characters
ok i know how to convet a character to a decimal number from the ascii code but how do u go back the other way

EX. if i have 97 it changes it to 'a'
any help will be greatly appreciated

Ascii Code Into Characters
Hey all.
i am an UBER n00b at this site and to Visual Basic. Currently i am taking a visual basc class at school but that leaves a LOT to be desired. ok here is my delima, don't laugh, its extremely n00bish:

I have a program to take a string and display it in its ascii code. This part was fairly easy but now i want to have the program convert a string of ascii code into characters forming a message. This is the code for the encoding part of my prog:

Private Sub optEncode_Click()
Dim strMessage As String
Dim I As Integer 'index for next loop statement
Dim strChar As String
Dim strAscii As String 'the ascii code to be displayed
Dim intLen As Integer 'number of characters

strMessage = InputBox("Enter message for encoding", "Please Type Message")
intLen = Len(strMessage)
For I = 1 To intLen
strChar = Mid(strMessage, I, 1)
strAscii = strAscii & " " & Asc(strChar)
Next I
lblDisplay.Caption = strAscii

End Sub

Pretty straight forward. i want to use a similar code to "decode" ascii the problem is i don't know how i would distinguish between character codes within the string as some are 2 digit and other 3, etc. Pleaze help this n00b!

Special ASCII Characters
Hi All!
How Can i use special character like ALT + 255 in my code??
i want to write to .ini file like [ALT+255] & BlahBLah how can i do this?

plz help

Iterating Over ASCII Characters

I want to use a for loop that iterates through the ASCII chars.

in c/c++ you can do this.

char asciichar = 'A';
for(int i = 0; i < 25; i++)

At the end, asciichar = 'Z'

Any help appreciated...TIA

Convert Characters To Ascii No.
i have an array called chars(). when my program runs, 1 character is stored in each variable of the array eg. chars (0) stores 1 character, chars(1) stores 1 character and so on. i heard that there are 256 ascii characters, is there a simple and fast way to convert each character into its ascii number, say chars(0) had the letter u stored in it and the number of u was 132 then chars(0) would be changed to 132

ASCII Special Characters
I am working on a text editor which will allow my wife to write text in a language other than English (French and Spanish specifically). I want to make a series of buttons which will input one of the accented letters into the text box. How can I render a special character by simply clicking a button? I know what the codes are to create these characters in Word. Can I use the same codes?

ASCII To Actual Characters
Dim integer s
s = 65

This will display 65, obviously. How do I get it to display "a" (65 is the ASCII code for a.


Checking For Non ASCII Characters

How would I be able to parse a file and check for non ASCII characters?? I want to parse files that come from a mainframe to ensure that there are all ASCII characters in them.

Any help would be appreciated.

Characters For ASCII Codes
I am trying to print out the characters for the numeric ASCII codes (e.g., 65 = 'A') It is printing out the numbers but not the letters. I don't know what I am doing wrong...Here is my code:

Dim i As Integer
For i = 65 To 90
Chr$ (i)
Print i
Next i

Are ASCII Characters 128-255 Used In Files?
Just wondering (actually I kind of have a reason) if those characters are used or it's just the first 128. Also, ASCII 0 is nothing, right? If so, why would anybody use it? Is A = Chr$(1) & Chr$(0) & Chr$(1) the same thing as A = Chr$(1) & Chr$(1)

Where Is The List Of ASCII Characters?
I'm not sure that's how I should have worded the subject- I want to know what all the different Chr$(whatevers) are, how many of them there are (I'm guessing 255), and what different combinations there are. Or are there any true combinations? VbCrLF is supposedly chr$(13) + chr$(10) but is that really a combination or is just a way of saying vbCR and then vbLf? Babble babble babble, thanks for any help.

Ascii Characters In Strings
I am new and need some help with trying to pick off a set of double quotes in a string. I know that I have to use the ascii equivilent, but I am unsure of the exact syntax it must be in, can someone assist? I have included the section of coded below. I have replaced the double quote with an exclamation point for clarity.

If Mid(InputLine, I, 1) = "!" Then

inside_word = 0
End If

If Mid(InputLine, I, 1) = " " And inside_word = 0 Then
If Mid(InputLine, I - 1, 1) = "!" Then
end_ptr = I - 1
end_ptr = I
End If

Extended Ascii Characters - Vb6 Under Windows Xp Sp2
I am not sure this is a Unicode problem or else. Here was part of a program that simply composed a string.

dim strTemp as string
strTemp = Chr$(&HC7&) & "0001" & Chr$(&H04&)

It ran fine under Windows 2K pro. I tried to run the same program under Window XP SP2. It seemed to be having problems for extended ascii part (>128). Characters <=128 didn't have problem at all.

Under WinXP, I tried this in immidiate window:

print hex(asc(mid(strTemp,1,1)))

while the same command give you right answer under Windows 2K, i.e. C7.

Can any one tell me on what might be the problem?


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.

Populate List Box With Ascii Characters
I am trying to populate a list box with the ascii characters with the characters from 1 thru 126. Below is my code, and it does not work. Could you point me in the right direction.

Private Sub Command1_Click()
Dim i
i = 1

Do While i <= 126

List1.AddItem Asc(i)

i = i + 1

End Sub

Thank You,

Convert Characters Into Their ASCII Number..
What is the command to turn Characters into their ascii value?

I know chr$(#) turns the number into a character..

I can't remember how to reverse it though.


Pulling Out Extended ASCII Characters...
Hey guys,

Ive got a dilemma and I knew that someone here could help. We have a file that we transmit through FTP to a client. we are transmitting this file from a DB2 As/400 which allows extended ASCII characters. Unfortunately, the system we are sending the file to does not allow extended ASCII. we had a file where someone had accidentally inserted an ext. ASCII character and the file transfer failed. As a side note, it took us 6 hours to send the file so this is not something we want to happen on a regular basis.

Ive been charged with the task of writing a program that will remove any extended ASCII characters from the file before we send it. if its possible.

I simply looked at my supervisor with a blank look on my face and said ok. so now I'm here.

Is there a function or API call that will perform this? writing my own function seems futile so I'm searching for some real brilliance here from you guys.

Thanks for any ideas that you guys can provide.

MSComm Will Only Output 8 ASCII Characters
Hi All,

I have a sign that requires a simple ASCII srting to be sent to it via com port to change its display. I have created a very simple project to test it using MSComm control but it wont work. I have connected an other pc to read the com port with hyper terminal to test my projects output. It reads the output but my program can only send 8 characters. If I send any more it only sends the last charecter. Any ideas?



Asynckeystate, Ascii, Characters And Numbers
Hi there,
 I am currently in the process of making a key logging program. However, I have become stuck on the following bit of code. Basically, it can currently distinguish between Capitals and lowercase characters, but messes up when I try to enter a number.

When i remove the "+32" parts in the code, the numbers display correctly.

Basically, is there any function to determine whether a number was pressed instead of a letter, or am i going about this all wrong?


For i = 33 To 128
    Result = 0
    Result = GetAsyncKeyState(i)

    If Result = -32767 Then

        If kCaps = 1 Then
            If GetAsyncKeyState(vbKeyShift) <> 0 Then
                txtLog.Text = txtLog.Text + Chr$(i + 32)
            ElseIf GetAsyncKeyState(vbKeyShift) = 0 Then
                txtLog.Text = txtLog.Text + Chr$(i)
            End If
            If GetAsyncKeyState(vbKeyShift) <> 0 Then
                txtLog.Text = txtLog.Text + Chr$(i)
            ElseIf GetAsyncKeyState(vbKeyShift) = 0 Then
                txtLog.Text = txtLog.Text + Chr$(i + 32)
            End If
        End If
    End If

Next i

Open File With Non-ascii Characters
Dear All,,

Can anybody help me to read this textfile (.txt).
The file contains of 7 lines and 2 columns of data in wich are separated by a [Tab] ,,

Server IP        Username
----------------    -----------    acmog    nlt    AQHa>W    +A+P    hodoncw    mumin    dhogorcad    

my problem is: when i wanna count total lines of a text file it returns only 4 instead of 7 becouse it terminates on (+A+P)
where unwanted characters are included. so please help me.

i have used the following lines of code to get it.

   Dim iCount As Integer, LineData as String
   Open FileName For Input As #1
   Do While Not EOF(1)

      Line Input #1, LineData
      iCount = iCount + 1

Thanks for your help..

Edited by - AbbydonKrafts on 5/26/2007 6:45:48 PM

Removing Strange Characters From A Csv Ascii File
I need to write a small prog that will simply remove certain characters from a csv ascii file. The file is for a register that we use in our school.

Every now and then, for some reason, strange characters appear in the file and thus the registers are all wrong. the ascii value of the characters that appear is 221 i believe.

I just need to write a prog that will search through and remove just these randomly placed characters. I say random, they always appear at the beggining of the line of characters.

Any help would be great



Help Me Figure Out How To Convert 3 Ascii Characters Into Time?
I am making a stats program for the game half-life, if i send a string to the server through udp, i get back a packet that has the player info, which contains their name, how many frags they have and also 3 ascii characters that somehow represent their time in the game... name is easy, its just written in normal letters, the frags is a single character ascii but it is easy to figure it since you just use Asc() to turn it into a a number
Well i have been stuck on the player's time in game for a while now, it is 3 ascii characters, im not sure if you have to do anything with hex, or anythign else, but i cant figure it out, here is a list of the characters ive put together and along with that their APROXAMATE time i use another program to retrive, ive went ahead already and converted the ascii charactes into their numbers using the Asc() function

Maybe someone with more brain power can figure how i would turn the 3 characters into seconds, i belive it is in seconds, but i dont think just multiplying or deviding will work... IF YOU CAN SOLVE THIS MYSTRY I WILL BE GREATFUL, thanx a bunch!


67 37 32 <-42m
67 245 29 <-42m
179 72 18 <-39m
51 24 19 <-39m
179 23 19 <-39m
51 22 19 <-39m
179 13 19 <-39m
143 132 16 <-38m
143 84 14 <-37m
71 7 13 <-37m
143 147 9 <-36m
102 216 255 <-34m
102 222 246 <-32m
102 126 242 <-32m
133 99 242 <-32m
102 252 232 <-31m
102 186 223 <-29m
31 34 211 <-28m
133 87 212 <-28m
31 22 181 <-24m
102 247 168 <-22m
102 235 138 <-18m
102 122 139 <-18m
102 120 139 <-18m
102 112 139 <-18m
102 125 139 <-18m
102 126 139 <-18m
142 203 130 <-17m
28 93 68 <-13m
28 91 68 <-13m
28 85 68 <-13m
28 83 68 <-13m
28 75 68 <-13m
28 71 68 <-13m
28 61 68 <-13m
28 37 68 <-13m
28 13 68 <-13m
28 123 67 <-13m
11 65 54 <-12m
28 177 1 <-8m
124 124 239 <-7m
22 14 234 <-7m
22 10 234 <-7m
22 254 233 <-7m
22 250 233 <-7m
22 234 233 <-7m
22 226 233 <-7m
22 206 233 <-7m
22 158 233 <-7m
22 110 233 <-7m
22 74 232 <-7m
247 16 90 <-3m
247 8 90 <-3m
247 240 89 <-3m
247 232 89 <-3m
247 200 89 <-3m
247 184 89 <-3m
247 144 89 <-3m
247 48 89 <-3m
247 208 88 <-3m
247 136 86 <-3m
44 108 73 <-3m
47 163 13 <-2m
225 56 225 <-1m

oh, and if it helps any, i looked in the protcol readme for this information, and it says
players name is a string
players frag is int32
and for the players time in game, it says its float32
btw, the protocol was also meant for C++

Read Database Dbf Field With Characters Between Ascii 128 And 255
I have a problem to read a field from a dbase dbf file. This field is a text field, but the data stored in this field is a hexadecimal value. To use this data I need to calculate the "asc" of this string. The characters below 128 are calculated correctly. For characters between 128 and 255 I calculate the wrong byte value.
When I monitor the dbf file with DBFView from Apycom I see the correct string only if I change the option DOS/WINDOWS to Windows. In visual basic I receive the string as represented in DOS.
Is there a possibility to extract the data from the database and receive the correct string in visual basic. I have tried to convert the character in visual basic but not with the right results.
Or is it possible to read the field binairy with ado.
Any suggestions??


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


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.



Writing Double Byte Characters Into Ascii File

I need to write some text string reading from a database into ascii file. The string could be a mix of English and double byte characters like Japanese etc.

Can I write in the following way (sequential file type)

Open FileName For Append As #1
Print #1, text
Close #1

or do I need to open a binary file for writing??


Handling Double Byte Characters In ASCII File

Sorry for shootting questions again on double byte character set. I'm writing an application for extracting data from SQL server and writing into ascii files. The application is written in VB and would run in multiple countries like Japan, china etc. I've no issues with countries which have all their data in English. The application will be running on the respective regional Windows Operating system of countries. When running for Japan, the double byte characters are written properly in the respective positions in the ASCII file meaning if column positions 1-10 are for name, then I can see 10 Japanese characters. ( This holds good even if the charcaters are a mix of English and Japanese). When I open this file in any Windows system with default Japanese code page, then col 1-10 would display these charcaters properly. But if I open the same file with default code page as English, then this would actually take 20 column positions if all the characters are Japanese(every charcater is split into 2 positions and the characters appear as garbage). The destiantion program reads and interprets the files based on the column positions and because of the double byte split , the destination program can not get the correct values . Moreover the destination program is running on a Unix machine and it receives feeds from multiple countries. So when it expects col 1-10 as Name, 11-20 as ID, works fine if all the characters are english, but if is a double byte , then column positions would have shifted because of the double byte split and it cannot interpret values properly. Can any one help me in handling this?

Thanks in Advance


Word VBA/Macro To Find All Non-ascii/non-ansi Characters...?
Hi all,

I am trying to find a way to identify all of the Japanese, non-ascii, non-ansi characters (excluding formatting marks) in a Word document.

I work in the document translation business (I proofread documents that have been translated, Japanese -> English) and find that oftentimes our translators leave a few, stray double-byte characters in the text (I'm only worried about full-width/zenkaku characters as opposed to hankaku characters).

I need to have a quick way of searching through a Word doc (we use Office XP) to find and highlight these characters so I can then go through and change them to their single-byte equivalents.

So far I have tried creating a macro to check each individual word by comparing its byte-length before, and after, converting it to double-byte Unicode (i.e. if the size is the same before and after, then I know I found a double-byte word). However, needless to say, THIS IS TOO SLOW (the average document is anywhere from 50,000 to 150,000+ words)!

I have also tried using the built-in Find function with the following wildcard string which searches for characters that are NOT ascii:

[!^0013-^0255^t^m^x^z^l^n^11@* ]*

However, for some reason if there is a table, the Find function stops at the end of each cell, just before what looks like a carriage return (it's not a regular return because those are successfully ignored throughout the rest of the document. Also, Word doesn't highlight the character itself: the cursor simply stops there and there is nothing visibly highlighted). It must be stopping because of some zero-width or hidden character. I have set the options to show all formatting marks, print and web layout options, etc. Simply hiding all formatting marks doesn't cut it: it stops at the same places either way.

Once I find a regex that works, then I'll record a macro to automate the process more, but right now, I'm still missing a piece or two.

Having said all this, I am still open to other possibilities:

For example, the Word Count function (Tools > Word Count...) displays a value for 'Asian characters, Korean words'. Does anyone know how this value is calculated? Can it be calculated/accessed via VB/VBA somehow?, etc.

Any help would be appreciated. I apologize for the long post, but being new to this forum I don't want you to think that I don't "do my homework" before posting...


RESOLVED: Read Database Dbf Field With Characters Between Ascii 128 And 255
I have a problem to read a field from a dbase dbf file. This field is a text field, but the data stored in this field is a hexadecimal value. To use this data I need to calculate the "asc" of this string. The characters below 128 are calculated correctly. For characters between 128 and 255 I calculate the wrong byte value.
When I monitor the dbf file with DBFView from Apycom I see the correct string only if I change the option DOS/WINDOWS to Windows. In visual basic I receive the string as represented in DOS.
Is there a possibility to extract the data from the database and receive the correct string in visual basic. I have tried to convert the character in visual basic but not with the right results.
Or is it possible to read the field binairy with ado.
Any suggestions??


Converting ASCII Back Into Characters...[Resolved By Manavo11]
is there any simple way to do this? Basically the goal is to lock out certain keys on the keyboard by ascii value so the person doesn't input numbers where only letters go and vice versa.

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