ascii

Inserting a "£" sign in an output string in C++

I have the following code: cout << "String that includes a £ sign"; However, the £ sign is not being recognised by the compiler, and instead an accented u is being displayed. I'm able to insert one using the following method: cout << "String that includes a " << char(156) << " sign"; where 156 is the ASCII code of the £ sign. Is th...

Erlang: How does one avoid Lists being translated to ASCII Strings?

[97, 98, 99]. yields "abc", in the Erlang shell. I realize this is because the ASCII values of a, b and c are 97, 98 and 99 respectively. So.. how would one go about returning [97,98,99] without Erlang translating it to ASCII? ...

Python regex to convert non-ascii characters in a string to closest ascii equivalents.

I'm seeking simple Python function that takes a string and returns a similar one but with all non-ascii characters converted to their closest ascii equivalent. For example, diacritics and whatnot should be dropped. I'm imagining there must be a pretty canonical way to do this and there are plenty of related stackoverflow questions but I'...

Strict string to byte encoding in C#

I've just stumbled over another question in which someone suggested to use new ASCIIEncoding().GetBytes(someString) to convert from a string to bytes. For me it was obvious that it shouldn't work for non-ASCII characters. But as it turns out, ASCIIEncoding happily replaces invalid characters with '?'. I'm very confused about this because...

how can i display the desire value in ascii codes inputted by me?

i need java codes. pls help me. example. when i enter the number in ASCII; 0 the output will be nul 1 for soh 2 for stx until it reaches the max number of ascii. please i need it now. thanks in advance ;) pls consider this code.. this code output is a ascii number. how can i reverse it? String test = "ABCD"; for ( int i = 0; i < t...

ASCII and printf

I have a little (big, dumb?) question about int and chars in C. I rememeber from my studies that "chars are little integers and viceversa," and that's okay to me. If I need to use small numbers, the best way is to use a char type. But in a code like this: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int ...

Write a program to check if a character forms an escape character in C.

I was trying to check whether or not an alphabet perpended by a \ would form an escape character in C. What would be the easiest way to check this? I tried to append "\" with ASCII of the character set but it failed Edit: I dont want to manually append the characters. If I could somehow iterate within the ASCII values and append and ...

Decode C++ encoded ASCII extended values?

Hi guys, I have a little question regarding ASCII Codes. Is it possible to to find out what type of encoding is used in C++ for ASCII extended values? I want to try and find a way to decode a game animation source file without having to de-compile the game source which is not allowed. I simply want to understand whats going on in the fi...

Rails 3 invalid multibyte char (US-ASCII)

I found a similar post here but I can't solve the problem anyway. I got this /home/fra/siti/Pensiero/db/seeds.rb:32: invalid multibyte char (US-ASCII) /home/fra/siti/Pensiero/db/seeds.rb:32: invalid multibyte char (US-ASCII) /home/fra/siti/Pensiero/db/seeds.rb:32: syntax error, unexpected $end, expecting ')' ... ed il valore della vita,...

Python Unicode CSV export (using Django)

Hi All, I'm using a Django app to export a string to a CSV file. The string is a message that was submitted through a front end form. However, I've been getting this error when a unicode single quote is provided in the input. UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 200: ordinal not in rang...

.NET: Reading/writing binary string

EDIT: Don't answer; I've found the solution on my own. I have some code that does this: using (var stream = new FileStream(args[1], FileMode.Create)) { using (var writer = new BinaryWriter(stream)) { writer.Write(ip.Iso3166CountryCode); ... } } Iso3166CountryCode is a string with two characters ("US"). When I try to read "US"...

Convert from ß to s c++

Is there a way in c++ to convert from ö to o, or ß to s, in general from utf-8 to the corresponding char from ASCII ? ...

How VARCHAR/CHAR manages to store/render multinational symbols in SQL Server?

I have used to read that varchar (char) is used for storing ASCII characters with 1 bute per character while nvarchar (varchar) uses UNICODE with 2 bytes. But which ASCII? In SSMS 2008 R2 DECLARE @temp VARCHAR(3); --CHAR(3) SET @temp = 'ЮЯç'; --cyryllic + portuguese-specific letters select @temp,datalength(@temp) -- results in --...

Extended ASCII question

Hi, I read wikipedia but I do not understand whether extended ASCII is still just ASCII and is available on any computer that would run my console application? Also if I understand it correctly, I can write an ASCII char only by using its unicode code in VB or C#. Thank you ...

Convert Ascii 2 Unicode from a font map using Php

I'm trying to convert old text in ascii non-english font to new unicode font. So the keys hav to maped. I have to option. First thing is i have a map file like this sample.map(txtfile) w=ം x=ഃ A=അ B=ആ C=ഇ Cu=ഈ D=ഉ Du=ഊ E=ഋ \p=ഌ F=എ G=ഠsF=ഠH=ഒ Hm=ഓ Hu=ഔ I=ക J=ഖ The code will have to replace all the l...

Javascript ascii to unicode with this code

I'm trying to convert texts written in local ascii non-english font to standard unicode. The problem is that we have to use a map file to map each char to which unicode char. Luckily i found a ready open source piece of code within an firefox addon. It's part of bigger application and i don't understand how I can use it independently. ...

Byte array to utf8 string

How do I get my byte array to a string that handles the Swedish letters å ä ö? I do this at the moment: NSString *hexString = [NSString stringWithFormat:@"%c", resData[i]]; (resData contains ascii characters) But when I use the hexString in my output label I get jibberish for all non English chars. How can I make a selected byte to an ...

Handle special characters in ASCII

Hello, My Javascript function returns a char arrya which might contain non-printable characters. In fact each character is a byte (represented as a number from 0-255). The problem is that when I try to copy this char array to the notepad, for example, I get these results: ORIGINAL STRING IN JAVASCRIPT: performance of thisĎask, ćd so mo...

How to output a the contents of an array selectively with a IF statement

I have having some trouble printing a "char" from an ASCII value stored in an array. The goal overall is to read a string of input from the user, store that in an array. Then use another array to count the number of times each character appears in the string, storing the number of occurances in the array address that matches the ASCII c...

How do I pass username and password to an httpWebRequest in silverlight 4

How do I pass username and password to an HttpWebRequest in Silverlight 4. since the HttpWebRequst class in silverlight does not implement Credentials property, therefore i am unable to authenticate my user. one way I found was, to pass credentials in header using Authorization header, but it requires ASCII encoded value, which is not...