ascii

Regex - Special alpha characters? - Python

I have a list of simple names such as Márquez, because of the á (?< name >[a-zA-Z]+) doesn't seem to be working! Help would be very much appreciated! ...

String that contains all ascii characters

Hi, I want to create a string in JavaScript that contains all ascii characters. How can I do this? ...

iPhone how do I programmatically substitute a degree symbol for the letter o in a string?

I know how to replace text in a string. But that's using keyboard (ASCII) characters. In Objective C, how do I indicate a degree symbol? Also, how do I get the ASCII code for a character? ...

Are Extended ASCII characters safe for filenames & folders?

My C# project saves files and creates folders with the extended ASCII character "²" (superscript 2). Is this safe to work with internationally? Is this something that could cause any issues with the .NET libraries or Windows functions? ...

Django approximate matching of unicode strings with ascii equivalents

I have the following model and instance: class Bashable(models.Model): name = models.CharField(max_length=100) >>> foo = Bashable.objects.create(name=u"piñata") Now I want to be able to search for objects, but using ascii characters rather than unicode, something like this: >>> Bashable.objects.filter(name__lookslike="pinata") ...

Using C# to detect whether a filename character is considered international

I've written a small console application (source below) to locate and optionally rename files containing international characters, as they are a source of constant pain with most source control systems (some background on this below). The code I'm using has a simple dictionary with characters to look for and replace (and nukes every othe...

How to convert an ASCII HEX character to it's value (0-15)?

I am writing a string parser and the thought occurred to me that there might be some really interesting ways to convert an ASCII hexadecimal character [0-9A-Fa-f] to it's numeric value. What are the quickest, shortest, most elegant or most obscure ways to convert [0-9A-Fa-f] to it's value between 0 and 15? Assume, if you like, that the...

How to convert an UTF string with scandinavian characters to ASCII?

I would like to convert this string foo_utf = u'nästy chäräctörs with å and co.' # unicode into this foo_ascii = 'nästy chäräctörs with å and co.' # ASCII . Any idea how to do this in Python (2.6)? I found unicodedata module but I have no idea how to do the transformation. ...

Ascii Bytes Array To Int32 or Double

I'm re-writing alibrary with a mandate to make it totally allocation free. The goal is to have 0 collections after the app's startup phase is done. Previously, there were a lot of calls like this: Int32 foo = Int32.Parse(ASCIIEncoding.ASCII.GetString(bytes, start, length)); Which I believe is allocating a string. I couldn't find a ...

How can I catch non valid ASCII characters in Panic Coda?

Sometimes I get errors while coding, because of typing some combination of keys (eg. ALT + SHIFT + SQUARE BRACKET) in a wrong way. So I get Syntax Error in Python, but I can't see where the illegal character is, 'cause Coda do not show it to me. Any solution? ...

How can I translate Linux keycodes from /dev/input/event* to ASCII in Perl?

I'm writing a Perl script that reads data from the infamous /dev/input/event* and I didn't find a way to translate the key codes generated by the kernel into ASCII. I'm talking about the linux key codes in this table here and I can't seem to find something that would help me translate them without hardcoding an array into the script. ...

Python: fetching SVG file using urllib is returning binary when I need ASCII

I'm using urllib (in Python) to fetch an SVG file: import urllib urllib.urlopen('http://alpha.vectors.cloudmade.com/BC9A493B41014CAABB98F0471D759707/-122.2487,37.87588,-122.265823,37.868054?styleid=1&amp;viewport=400x231').read() which produces output of the sort: xb6\xf6\x00\xb3\xfb2\xff\xda\xc5\xf2\xc2\x14\xef\xcd\x82\x0b\xdbU\xb0...

Efficient way to ASCII encode UTF-8

I'm looking for a simple and efficient way to store UTF-8 strings in ASCII-7. With efficient I mean the following: all ASCII alphanumeric chars in the input should stay the same ASCII alphanumeric chars in the output the resulting string should be as short as possible the operation needs to be reversable without any data loss the resul...

Non-Ascii characters not supported by .net?

Hi All, When I added a class with non-Ascii caharacters in the class name, it removed the non-Ascii from class name and when added directly to class it complains of non-Ascii characters. Are Non-ASCII characters not supported in class name and variable name? ...

NSString - Unicode to ASCII equivalent

Hello, I need to convert NSString in unicode to NSString in ASCII changing all local characters: Ą to A, Ś to S, Ó to O, ü to u, And do on... What is the simplest way to do it? ...

Why does Python print unicode characters when the default encoding is ASCII?

From the Python 2.6 shell: >>> import sys >>> print sys.getdefaultencoding() ascii >>> print u'\xe9' é >>> I expected to have either some gibberish or an Error after the print statement, since the "é" character isn't part of ASCII and I haven't specified an encoding. I guess I don't understand what ASCII being the default encoding me...

Bitwise Shifting in C

I've recently decided to undertake an SMS project for sending and receiving SMS though a mobile. The data is sent in PDU format - I am required to change ASCII characters to 7 bit GSM alphabet characters. To do this I've come across several examples, such as http://www.dreamfabric.com/sms/hello.html This example shows Rightmost bits o...

emulate ENTER in .txt

Can someone please help in adding a command for "ENTER" in a .txt file to emulate "ENTER". Example; 12345 "enter" 548793 "ENTER" ..... where an entry will be a number followed by enter to next field where the next number will be inserted etc.. so it will look like this: 12345 548793 etc... ...

Special Characters on Console

I've finished my poker game but now I want to make it look a bit better with displaying Spades, Hearts, Diamonds and Clubs. I tried this answer: http://stackoverflow.com/questions/2094366/c-printing-ascii-heart-and-diamonds-with-platform-independent Maybe stupid but I try: cout << 'U+2662' << endl; I don't know how to write it. ...

Convert Unicode char to closest (most similar) char in ASCII (.NET)

How do I to convert different Unicode characters to their closest ASCII equivalents? Like Ä -> A. I googled but didn't find any suitable solution. The trick Encoding.ASCII.GetBytes("Ä")[0] didn't work. (Result was ?). I found that there is a class Encoder that has a Fallback property that is exactly for cases when char can't be convert...