ascii

What's the equivalent of VB's Asc() and Chr() functions in C#?

VB has a couple of native functions for converting a char to an ASCII value and vice versa - Asc() and Chr(). Now I need to get the equivalent functionality in C#. What's the best way? ...

Non ASCII char in PHP?

Hello, I am trying to send something to serial port (r232) with PHP. I am using this class: http://www.phpclasses.org/browse/package/3679.html The problem is that I am allowed to send only 1 byte. But if I send something like "1", I am actually sending 49 (ASCII for 1). Instead of send("1"), I tried with send(1) but it is no good, becau...

How do I handle every ASCII character (including regex special characters) in a Perl regex?

I have the following code in Perl: if (index ($retval, $_[2]) != -1) { @fs = split ($_[2], $_[1]); $_[2] is the delimiter variable and $_[1] is the string that the delimiter may exist in. ($_[0] is used elsewhere) You may have guessed that this code is in a subroutine by those variable names. Anyway, onto my question, when my del...

C/C++: How to convert 6bit ASCII to 7bit ASCII

Hey everyone, I have a set of 6 bits that represent a 7bit ASCII character. How can I get the correct 7bit ASCII code out of the 6 bits I have? Just append a zero and do an bitwise OR? Thanks for your help. Lennart ...

Recognizing extended characters using JAVACC

I'm creating a grammar using JavaCC and have run across a small problem. I'm trying to allow for any valid character within the ASCII extended set to be recognized by the resulting compiler. After looking at the same JavaCC examples (primarily the example showing the JavaCC Grammer itself) I set up the following token to recognize my cha...

DataTable column sort in ASCII order, not

If I have two strings, and I need to compare them in ASCII order (instead of the invariant culture order) I can generally use: int c = String.Compare(a, b, StringComparison.Ordinal); If I have a DataTable, and I want one of the columns sorted using an Ordinal string comparison for the DataView , how do I go about it? ...

Are digits represented in sequence in all text encodings?

This question is language agnostic but is inspired by these c/c++ questions. How to convert a single char into an int Char to int conversion in C Is it safe to assume that the characters for digits (0123456789) appear contigiously in all text encodings? i.e. is it safe to assume that '9'-'8' = 1 '9'-'7' = 2 ... '9'-'0' = 9 in all...

Where is Python's "best ASCII for this Unicode" database?

I have some text that uses Unicode punctuation, like left double quote, right single quote for apostrophe, and so on, and I need it in ASCII. Does Python have a database of these characters with obvious ASCII substitutes so I can do better than turning them all into "?" ? ...

Check a webpage remotely to see if if its ASCII or Binary

Hello, Is it possible to check remotely (no local/FTP access) a URL to see if the webpage (file) was uploaded/created as binary or ascii? Thanks, Roy. ...

How to convert large UTF-8 strings into ASCII?

I need to convert large UTF-8 strings into ASCII. It should be reversible, and ideally a quick/lightweight algorithm. How can I do this? I need the source code (using loops) or the JavaScript code. (should not be dependent on any platform/framework/library) Edit: I understand that the ASCII representation will not look correct and wou...

Python ASCII Graph Drawing

Hi, I'm looking for a library to draw ASCII graphs (for use in a console) with Python. The graph is quite simple: it's only a flow chart for pipelines. I saw NetworkX and igraph, but didn't see a way to output to ascii. Do you have experience in this? Thanks a lot! Patrick EDIT 1: I actually found a library doing what I need, but i...

Is there a function that returns the ASCII value of a character? (C++)

I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc... On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers? ...

Integer ASCII value to character in BASH using printf

Character to value works: $ printf "%d\n" \'A 65 $ I have two questions, the first one is most important: How do I take 65 and turn it into A? \'A converts an ASCII character to its value using printf. Is the syntax specific to printf or is it used anywhere else in BASH? (Such small strings are hard to Google for.) ...

How can I get the corner points from a series of points in a square shape?

I'm trying to extract the corners of a square in an image, I've managed to extract all the pixels around the square as x,y coordinates. Problem is now that I need to filter those down to only 4 corners I'm not sure what the best approach would be. My first thought was to get the angles between each point and if the angle differs more th...

unicode in php

I have previously read Spolsky's article on character-encoding, as well as this from dive into python 3. I know php is getting Unicode at some point, but I am having trouble understanding why this is such a big deal. If php-CLI is being used, ok it makes sense. However, in the web server world, isnt it up to the browser to take this i...

Convert A String (like testing123) To Binary In Java

I would like to be able to convert a String (with words/letters) to other forms, like binary. How would I go about doing this. I am coding in BLUEJ (Java). Thanks ...

replace characters in a file (faster method)

We often replace non-desirable characters in a file with another "good" character. The interface is: procedure cleanfileASCII2(vfilename: string; vgood: integer; voutfilename: string); To replace all non-desirables with a space we might call, cleanfileASCII2(original.txt, 32 , cleaned.txt) The problem is that this takes a rather lon...

How can I covert a binary file into a set of ascii charecters

I want to convert a binary file into an array of ascii charcters . how can I do that . thank you . ...

c# and Encoding.ASCII.GetString

byte[] header = new byte[]{255, 216}; string ascii = Encoding.ASCII.GetString(header); I expect ASCII to be equal to be FFD8 (JPEG SOI marker) Instead I get "????" ...

Ruby: Replacing bullets pasted from MS Word

I need to remove bullet symbols from text pasted from MS Word, but I can't figure out what to match on. When printed to STDOUT the symbol displays as ⢠The ascii codes for these characters are 194 and 162. The ascii code for • symbols is 149 Any suggestions how to proceed either in JavaScript or Ruby code? ...