ascii

What is the best practice for creating libraries that support both Unicode and ASCII in C++?

I'm working on writing some libraries that will be used both internally and by customers and was wondering what the best method of supporting both Unicode and ASCII. It looks like Microsoft (in the MFC Libraries) writes both the Unicode and ASCII classes and does something similar to this in the header files using macros: #ifdef _UNICO...

Please explain ^[[A character combination

On Unix, when I press up arrow key, it shows this string, but while scanf, it does not take it as input. Please explain how to take it as input. Can we something like compare the character by charater like first ^[ is Esc key and so on? ...

Convert a-z to print out abcdef....z?

I want to be able to have a user input a-z or c-z or c-p or whatever and have it return the actual letters between those two. I figured I would have to use ASCII numbering so I could use these steps: 1) Look for '-', if true 2) Look at first char that was input(char a in a-z), find ASCII # 3) Look at last char that was input (char z ...

Converting Decimal to ASCII Character

I am trying to convert an decimal number to it's character equivalent. For example: int j = 65 // The character equivalent would be 'A'. Sorry, forgot to specify the language. I thought I did. I am using the Cocoa/Object-C. It is really frustrating. I have tried the following but it is still not converting correctly. char_num1 ...

How do I convert an ascii code to the escaped 'screen friendly' view?

In C# .Net I'm looking to convert an ascii value (13, 16 etc) to its escaped view (eg \n, \r, \t etc) for a selector. Is there a built in way to do this or do I have to resort to using a look up table? ...

prevent typing non ascii characters in a textbox

Since I think people have encounter it lots of time before I did and there may be some standart solution.. Can anybody give any hint direction how to prevent a user from typing non ascii characters in a textbox. ...

What's the proper technical term for "high ascii" characters?

What is the technically correct way of referring to "high ascii" or "extended ascii" characters? I don't just mean the range of 128-255, but any character beyond the 0-127 scope. Often they're called diacritics, accented letters, sometimes casually referred to as "national" or non-English characters, but these names are either imprecis...

I don't understand how Assembly works with ASCII?

I have a program that's supposed to take values and print them back out. But when the user enters something like 12, (C in HEX) the program prints out some weird letter, that I think is the representation in ASCII. Is there a way to make it save those numbers as raw numbers? I'm doing the input and output through an external library, so ...

C# Ensure string contains only ASCII

Hi, I have a C# routine that imports data from a csv file, matches it against a database and then rewrites it to a file. The source file seems to have a few non-ascii characters that are fouling up the processing routine. I already have a static method that I run each input field through but it performs basic checks like removing comm...

ASCII "graphics" library?

Is there a platform-independent C/C++ library that can draw simple "graphics" in pure ASCII in a console program? For example (VERY roughly) I could call a function in the library like rectangle(3, 6); to get the following output: ****** * * ****** Ultimately, I would love to be able to plot simple graphs based on input data tables...

HAML & RoR: Auto-convert apostrophes, etc., to ASCII HTML entities?

Is there anyway to have HAML automatically convert all my apostrophe's ' to the HTML character entity equivalents (’)? Ditto with all the other characters that one would want to convert (dashes, double-quotes, etc.) for better online readability. ? ...

How are ASCII characters stored in memory?

Consider a computer that has a byte addressable memory organized in 32 bit words according to the big endian scheme. A program reads ASCII characters entered at a keyboard and stores them in successive byte locations, starting at location 1000. Show the contents of two memory words at locations 1000 and 1004 after the name "johnson" has ...

ASCII strings and endianness

An intern who works with me showed me an exam he had taken in computer science about endianness issues. There was a question that showed an ASCII string "My-Pizza", and the student had to show how that string would be represented in memory on a little endian computer. Of course, this sounds like a trick question because ASCII strings a...

How to convert an ASCII value into a character in .NET

There are a million posts on here on how to convert a character to its ASCII value. Well I want the complete opposite. I have an ASCII value stored as an int and I want to display its ASCII character representation in a string. i.e. please display the code to convert the int 65 to A. What I have currently is String::Format("You typed '...

ASCII Library for Creating "Pretty" Directory Trees?

Is there some *nix tool or perl/php library that will let you easily create directory tree visualizations that look like the following? www |-- private | |-- app | | |-- php | | | |-- classes | | | +-- scripts | | |-- settings | | +-- sql | +-- lib | +-- ZendFramework-HEAD +-- public |...

Human-readable binary data using Python

My work requires that I perform a mathematical simulation whose parameters come from a binary file. The simulator can read such binary file without a problem. However, I need to peek inside the binary file to make sure the parameters are what I need them to be, and I cannot seem to be able to do it. I would like to write an script in P...

Method for generating numerical values from a URL

In the 90s there was a toy called Barcode Battler. It scanned barcodes, and from the values generated an RPG like monster with various stats such as hit points, attack power, magic power, etc. Could there be a way to do a similar thing with a URL? From just an ordinary URL, generate stats like that. I was thinking of maybe taking the ASC...

Convert non-ascii domain to SMTP compatible

When customers enter email addresses with non-ascii chars like äüö our SMTP rejects to process them. So I think might be there is a solution to handle those domains myself and convert them to punyocode. Is there a simple way of doing so using c#? Would this work anyway? ...

Corrupt image file after uploading it using ftp command from linux, with type ASCII

I have try to transfer a image file using ftp command in linux, from linux platform to windows platform, doing like this: ftp cs.unitbv.ro ascii get test.jpg After this, when I open the image it says that the file is corrupted. If somebody know how to repair the image file let me know. Thanks ...

Why do I get this error when I try to print something in Putty?

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 38: ordinal not in range(128) I am downloading a website and then printing its contents...simple. Do I have to encode it somehow? ...