473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Decode ASCII

i used a code to decode a ASCII code:
Expand|Select|Wrap|Line Numbers
  1. textbox1.text=chr(textbox2.text)
when i type 97 in textbox2, textbox1 show correct answer that is 'a'.
But when i type 9797, is there any possible ways to get 'aa' in textbox1?
Apr 18 '10 #1
4 3212
yarbrough40
320 100+
hmm well If that is all you want to do then a crude way of doing it is like this
Expand|Select|Wrap|Line Numbers
  1.  
  2.         Dim t1, t2 As String
  3.         If TextBox2.Text.Length = 4 Then
  4.             t1 = Chr(TextBox2.Text.Substring(0, 2))
  5.             t2 = Chr(TextBox2.Text.Substring(2, 2))
  6.         Else
  7.             t1 = Chr(TextBox2.Text)
  8.             t2 = ""
  9.         End If
  10.         TextBox1.Text = t1 & t2
  11.  
however it's not very practical because it assumes that the only two scenarios will be either a case of 1) two chars - both a two character ASCII, or 2) a single char with one or two ASCII characters.
if you could explain more comprehensively what you are trying to do, we may be able to help with a better solution.
Apr 18 '10 #2
tlhintoq
3,525 Expert 2GB
just do a loop... for the length of the textbox.text... get the next character... make the ascii... add it to the output... continue loop
Apr 18 '10 #3
@yarbrough40
actually what i want to do is I try to parse a few information in my system into ASCII and put it into database to secure it. After that, i can redeem it into my system again and use it.
Apr 18 '10 #4
@lauclaw
thank you all and i found my way
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer = 0
  2.         Dim l As Integer = Me.TextBox2.Text.Length
  3.         Dim a As String = Nothing
  4.         While i < l
  5.             If Me.TextBox2.Text.Substring(i, 2) > 31 And Me.TextBox2.Text.Substring(i, 2) < 130 Then
  6.                 a += Chr(TextBox2.Text.Substring(i, 2))
  7.                 i += 2
  8.             Else
  9.                 a += Chr(TextBox2.Text.Substring(i, 3))
  10.                 i += 3
  11.             End If
  12.         End While
  13.         Me.TextBox3.Text = a
Apr 18 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robin Siebler | last post by:
I have no idea what is causing this error, or how to fix it. The full error is: Traceback (most recent call last): File "D:\ScriptRuntime\PS\Automation\Handlers\SCMTestToolResourceToolsBAT.py",...
1
by: Tumurbaatar S. | last post by:
When a browser sends (get or post) a form data containing non-ASCII char-s (i.e. above 127), Request returns some char-s encoded like '&#nnn'. It seems that when I used a standard WindowsXP...
11
by: Ramprasad A Padmanabhan | last post by:
Hello, Can anyone tell me where Can I find a function that can decode a url encoded string like ram%40domain.tld ==> ram@domain.tld Thanks Ram
2
by: aurora | last post by:
I have some unicode string with some characters encode using python notation like '\n' for LF. I need to convert that to the actual LF character. There is a 'unicode_escape' codec that seems to...
8
by: Lad | last post by:
To be able to decode a string successfully, I need to know what coding it is in. The string can be coded in utf8 or in windows-1250 or in another coding. Is there a method how to find out the...
1
by: Jammer | last post by:
Will a failed decode overwrite the variable? message = message.decode('iso-8859-1') or do I need to do msg = message.decode('iso-8859-1')
4
by: Oleg Parashchenko | last post by:
Hello, I'm working on an unicode-aware application. I like to use "print" to debug programs, but in this case it was nightmare. The most popular result of "print" was: UnicodeDecodeError:...
5
by: wingleader | last post by:
Hi everybody! I have such a problem. I wrote a web portal on C++, but I found one big "-" in that script: C++ is not supporting url decoding(I mean data sent by HMTL forms). As a developer I...
1
by: Eric S. Johansson | last post by:
I'm having a problem (Python 2.4) converting strings with random 8-bit characters into an escape form which is 7-bit clean for storage in a database. Here's an example: body =...
3
by: Gilles Ganault | last post by:
Hello I'm getting this error while downloading and parsing web pages: ===== title = m.group(1) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 48: ordinal not in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.