ascii

Allowed characters in submit forms (including UTF-8)

Hi, Suppose I allow my users to submit a form containing some text fields (I'm not talking about passwords). My users would occasionally use non-ASCII characters like Russian, Chinese, etc. so I use UTF-8 charsets in my database. The question is, should I really allow all of the possible UTF-8 characters? I had a look at the ASCII table...

How to get rid of non-ascii characters in ruby

I have a Ruby CGI (not rails) that picks photos and captions from a web form. My users are very keen on using smart quotes and ligatures, they are pasting from other sources. My web app does not deal well with these non-ASCII characters, is there a quick Ruby string manipulation routine that can get rid of non-ASCII chars? ...

Getting an ascii character code in ruby - ? fails

I'm in a situation where I need the ASCII value of a character (for Project Euler question #22, if you want to get specific) and I'm running into an issue. Being new to ruby, I googled it, and found that ? was the way to go - ?A or whatever. But when I incorporate it into my code, the result of that statement is the string "A" - no chara...

How to generate a random named text file in C#?

I have to make a loop to generate a 5 randomly-picked-letter string, and then create a text file under that name, lets say in C:// , how will I do that? Both the generating name and creating a file in the directory. I think I have to pick 5 random numbers from the ascii codes add them to an array and then convert them to the character eq...

Need to insert a 'dot' in textbox where the textbox is validated by using javascript to enter only numerical values.

Here is the code which woks perfectly and validate to enter only digits in a TEXT BOX. Now i have a problem there. My problem is i need to enter decimal values there. So i need to enter 'DOT' in the TEXT BOX. This validation has been done by using ASCII values. I even use the ASCII value of 'DOT -> 249, 250'. But it doesn't work. Any hel...

PHP equivalent of VB.net character codes

Hi, So I am calling an API written in VB.NET from PHP and passing it some text. I want to insert into that text two linebreaks. I understand that in VB.NET, the character codes for a linebreak are Chr(10) and Chr(13). How can I represent those in PHP? TIA. ...

How Can I read a file with both ASCII and another encoding in Java cleanly?

I have a custom image file where the first block of data is ASCII meta data. I need to be able to read this ASCII meta-data part of the file with Java and know when it ends, and when the 'raw image data' in another encoding starts. I was thinking of reading all of the file into a byte[], and then somehow either start reading bytes out ...

Java - is it possible to read a file line by line, stop, and then immediately start reading bytes where I stopped?

I'm having an issue trying to parse the ascii part of a file, and once I hit the end tag, IMMEDIATELY start reading in the bytes from that point on. Everything I know in Java to read off a line or a whole word creates a buffer, which ruins any chance of getting the bytes immediately following my stop point. Is the only way to do this rea...

Need to decode ascii for xml file, into literal characters

I have an xml file that is being used on a third party system, and I have no control over the third party system that is using the xml file. The third party system fails because there are ascii in the xml file. For example, it fails when it sees , when it wants a single quote ’ Is there a way to throw php code around the va...

What is the char that is displayed over hidden passwords?

If you type a password in a modern application, it usually displays a nice neat black circle - where more traditional app's would use an asterisk. How is that character created? Is it an ascii value (if so I can't find it)? If not, how is it created? ...

MIPS how can you compare a character taken from input?

Hello, My program asks the user if the number he/she is thinking of is in a list. The user inputs a y or an n. How can I check if a user has entered y or n in assembly? Is it sufficient to put the user input into a register and branch if equal to 121 (decimal ASCII code for 'y') or branch if the value is equal to 110 (decimal ASCII code...

Character Encoding Issue - Strange Behaviour From Pound Signs (£) with UTF-8 IE6 / ASP / XML

Hi folks, I am having a very strange problem with pound signs displaying incorrectly (or not at all) on a web page. I am keying text in a textbox, which then gets (briefly) stored in XML before being displayed in a new IE(6) window. The worst part is that this is inconsistent. I have three different things happening: 1. Pound sign doe...

How to make next step of a string. C#

The question is complicated but I will explain it in details. The goal is to make a function which will return next "step" of the given string. For example String.Step("a"); // = "b" String.Step("b"); // = "c" String.Step("g"); // = "h" String.Step("z"); // = "A" String.Step("A"); // = "B" String.Step("B"); // = "C" String.Step("G"...

Converting alphanumeric to ascii and incrementing

Hello all, I'm stumped on how to convert 3 letters and 3 numbers to ascii and increment them by one...it's the old next-license-plate problem. Can anyone give me a nudge in the right direction? ...

Encoding problem with nordic characters

I'm trying to send HL7 messages to a receiver. The receiver now says they got question marks instead of 'ä' and 'ö'. What should I do? Right now I do it about like this: I initialize System.Net.Sockets.TcpClient and then Dim data(payload.Length) As Byte Dim stream As System.Net.Sockets.NetworkStream = _tcpClient.GetStream() System.Tex...

Force C# (.Net 3.5) to use ASCII

I'm working on an application in C#, and need to read and write from a particular datafile format. The only issue at the moment is that the format uses strictly single byte characters, and C# keeps trying to throw in Unicode when I use a writer and a char array (which doubles filesize, among other serious issues). I've been working on mo...

Mysql ASCII vs Unicode

Just a quick one: Will SELECT ... WHERE name LIKE '...' query be faster if name column is ASCII rather then UTF-8? Thanks! ...

UTF-16 to ASCII conversion in Java

Hi, Having ignored it all this time, I am currently forcing myself to learn more about unicode in Java. There is an exercise I need to do about converting a UTF-16 string to 8-bit ASCII. Can someone please enlighten me how to do this in Java? I understand that you can't represent all possible unicode values in ASCII, so in this case...

characters in an encrypted blob

what are the all possible characters that could appear in an encrypted blob? in another word, for example, could '&' be a character in an encrypted blob? what about '+'? why? ...

Replacing specific non-printable characters in huge files from linux command line

I need to replace the ascii characters SOH and STX (start of header and start of text, ascii characters 1 and 2, respectively) in some really huge text files as quickly as possible... Is sed the way to go? What does that command look like? ...