FAQ Database Discussion Community

## hex to string chinese,chinese hex 2 byte ,english hex 1byte?

java,string,hex,ascii
this is stringToHexAsciiString. //将字符串转成ASCII十六进制的java方法 public static String stringToHexAsciiString(String value) { StringBuffer sbu = new StringBuffer(); char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { sbu.append(Integer.toHexString(chars[i])); } return sbu.toString(); } this is asciiToString begin //将ASCII转成字符串的java方法 public static String asciiToString(String value) { StringBuffer sbu = new StringBuffer();...

## Count lines in ASCII file using C

c,ascii,text-files
I would like to count the number of lines in an ASCII text file. I thought the best way to do this would be by counting the newlines in the file: for (int c = fgetc(fp); c != EOF; c = fgetc(fp)) { /* Count word line endings. */ if...

## ASCII Code for Uppercase/Capital R with a Tilde Character Above

ascii,stata
I am trying to get the equivalent of LaTeX's $\tilde R$ in a Stata graph axis label. I don't thinks there's a SMCL way of doing that, but it's possible to use ASCII characters. However, there does not seem to be an ASCII code for an uppercase/capital R with a...

## What does stripping off the ASCII template mean?

assembly,ascii,cpu-registers,computer-architecture,lc3
I am working on a practice exam problem The Problem On execution of this program, the user inputs two numbers. What is the value of xGuess so we can strip off the ASCII template? Explain. .ORIG x3000 TRAP x23 LD R2, ASCII ADD R1, R2, R0 TRAP x23 ADD R0,...

## how to put characters combination as constant command into iOS framework

ios,objective-c,unicode,frameworks,ascii
I am new to iOS programming. I am developing some SDK framework right now. I have a command with three characters: 'ESC' 'E' '1', I wanna combine those three characters to generate a NSString and put this NSString into framework. Therefore others can directly use this Constant in framework. Any...

## Most efficient way to convert ASCII to Binary in x86 Assembly

assembly,binary,x86,ascii
I have a number stored in memory as ASCII and want to convert it to its binary value (multiplied by 100). so 1.23 may be stored in memory in ASCII as 0x312E3233 and this should be converted to the binary value 123. I currently have the following but is there...

## convert ASCII character array to UNICODE string

c#,c,user-interface,unicode,ascii
I am calling a c dll function in c# which returns a 64 bit ASCII character array, since c# uses UNICODE how do I convert the ASCII character array to a UNICODE string? I have done this before by having the string in a struct because the function had a...

## how to convert from ascii code to normal code in python? [closed]

python,performance,ascii
I'm almost new in python and i want to solve a question,which is the AlphabetRunEncryption(str) function,that read the str parameter being passed which will be an encrypted string and the output should be the original decrypted string. Now I need a function or a fast and easy method to convert...

## Encode an executable file

c++,encoding,ascii
I want to Encode and Decode an executable file The problem is about NULL The file content is MZ(NULL) so the binary code will be 01001101 01011010 00000000 The output should should be: 4d (for M -> 0100 1101) 5a(for Z -> 0101 1010) and 00(for NULL -> 0000 0000)...

## Java KeyEvent.getKeyCode() return a virtual key or ASCII?

java,input,keyboard,ascii
I want to create an array of all keys on the keyboard. How many KeyCode are they ? KeyEvent.getKeyCode() return ASCII or Virtual Key?...

## Combine std::wstring and function

c++,string,ascii,sfml,wstring
I'm creating text in SFML 2.1 (It doesn't really matter) in c++. Setting a text string looks like that: text.setString("something"); Ok, but because my game language is Polish, I have to enter some characters like ą,ż,ł,ś,ć etc. , which are not 'supported' in my game's ASCII encoding. Iv'e came up...

## How to convert char ASCII to hex equivilent in C?

c,char,hex,ascii,lcd
So basically, I am writing code to control an LCD via a micro-controller. (atmega 32) I have the following in my main method: unsigned char str1[9] = "It Works!"; sendString(str1); and here is my sendString method: // Converts each char to hex and sends to LCD void sendString(unsigned char *string){...

## how to grep ASCII control character

grep,ascii
If I have a file containing ASCII control character, for example, ^A (Start of Header). How can I find it using grep in Linux?...

## Why is ASCII representation of this character returns as 226 128 153?

encoding,character-encoding,char,ascii
So I am playing with this tool: http://www.unit-conversion.info/texttools/ascii/ When I try this character: ' I see the value 039 which can be verified from: http://www.asciitable.com But I am curios about: ’ This character in the same tool will return: 226 128 153 But as far as I know ASCII is...

## Oracle query to find string not containing characters

regex,oracle,ascii
What is an Oracle query that will return all records where the field mytable.myname contains any characters other than A-Z a-z 0-9 -/\() ...

## I am finding difficulties to solve an expression [closed]

c,variables,ascii
I am finding difficulties to solve an expression please help me to do so. Declare four variables of type char. Initialize one variable to ‘z’. Initialize the other variables to the ASCII integer value for ‘z’, the ASCII octal value for ‘z’, and the ASCII hexadecimal value for ‘z’....

## RSA on ASCII message problems with '\0'

encryption,ascii,rsa,null-character
I want to encrypt and decrypt ASCII messages using an RSA algorithm written in assembly. I read that for security and efficiency reasons the encryption is normally not called character-wise but a number of characters is grouped and encrypted together (e.g. wikipedia says that 3 chars are grouped). Let us...

## Caesar Cipher w/Frequency Analysis how to proceed next?

c++,vector,ascii,frequency-analysis,caesar-cipher
I understand this has been asked before and I somewhat have a grasp on how to compare frequency tables between cipher and English(this is the language I'm assuming its in for my program) but I'm unsure about how to get this into code. void frequencyUpdate(std::vector< std::vector< std::string> > &file, std::vector<int>...

## Block typing in any other alphabet than english

javascript,validation,ascii,fromcharcode
I know the JavaScript that restricts entering some special characters or number, etc using charcode and ascii value. Is there anyway that I can block people entering any other language (I mean alphabet) expect English? More specifically how can I block people entering Chinese or some other non English alphabet...

## php split string every

php,string,ascii,explode
I have a txt file with ascii data which need to be converted into multiple strings. I already converted. Now what i don't know how to do is to cut every 63 times that the ";" appears. CODE: This is what i have done. to concert the file to a...

## Converting to ASCII with numbers above 128

python,python-3.x,ascii
Simple question, yet should be simple answer ^_^ Looked around and found nothing. I'm using python 3.4 and can convert numbers up to 128 with the print (chr(int)) method without trouble. 104 gives me "h", and 73 gives me "I". However, when I use numbers higher than 128, it gives...

## What is a code point and code space?

character-encoding,character,ascii
I was reading the Wikipedia article on code points, but not sure if I understand correctly. For example, the character encoding scheme ASCII comprises 128 code points in the range 0hex to 7Fhex So is 0hex a code point? Also could not find anything on code space. PS. If it's...

## How to convert Hangul letter(symbol) to latin [closed]

java,unicode,ascii
Language could be java. This is what I would like to accomplish: Basically, print out the pronunciation of the Hangul written word. ...

## Best way to Convert pairs of base 10 integers to ascii characters in python

python,python-2.7,ascii
I am talking to a piece of a test equipment using a serial interface. The two letter ascii ID of the device is encoded as a base 10 integer in a specific register. Each pair of integers needs to be converted to an ascii character. My question is what is...

## Regex Latin characters filter and non latin character filer

c#,regex,ascii,non-ascii-chars
I am developing program ,where I need to filter words and sentences which is non Latin character. The problem is, that I found only Latin character words and sentences , but I do not found words and sentences which are mixed with Latin characters and non Latin characters. For ex....

## Python - ASCII encoding string in the unicode string; how to remove that 'u'?

python,unicode,encoding,ascii,urlencode
When I use python module 'pygoogle' in chinese, I got url like u'http://zh.wikipedia.org/zh/\xe6\xb1\x89\xe8\xaf\xad' It's unicode but include ascii. I try to encode it back to utf-8 but the code be changed too. a = u'http://zh.wikipedia.org/zh/\xe6\xb1\x89\xe8\xaf\xad' a.encode('utf-8') >>> 'http://zh.wikipedia.org/zh/\xc3\xa6\xc2\xb1\xc2\x89\xc3\xa8\xc2\xaf\xc2\xad' Also I try to use : str(a) but I got error :...

## BeautifulSoup ascii error and csv

python,csv,beautifulsoup,ascii

## Is it possible to make conditions in ASCII? [closed]

ascii
I am working on a software that needs commands in ASCII to define alert thresholds. These thresholds, correspond to a quantity in littre according to a number of gas tank connected each others. Examples : -If it's 1 or 2 tanks the threshold will be 30 L and the ASCII...

## regex doesnt match the line starts with character e

regex,node.js,ascii
I have such a regex: /^[^(\-.+\n|content|\n\-.+\-{2})](.+)/igm This is a sample input: ------WebKitFormBoundaryKanSEkvcMamqayJY Content-Disposition: form-data; name="fl"; filename="emty" Content-Type: application/octet-stream this is trial ------WebKitFormBoundaryKanSEkvcMamqayJY-- I want to capture every line except those below: ------WebKitFormBoundaryKanSEkvcMamqayJY Content-Disposition: form-data; name="fl"; filename="emty" Content-Type: application/octet-stream ------WebKitFormBoundaryKanSEkvcMamqayJY-- This regex works well unless...

## troubles with understanding how ASCII works

encoding,byte,ascii,bit
I have few questions about ASCII encoding: How come there is 127 characters definable in ASCII coding? It should be 7-bit, which means 2 to the power of 7 which equals 128. Where is the one character missing? When I save a textfile as a textfile.txt it should be saved...

## What does the “^@” mean in file?

c,gcc,ascii,control-characters
Code: int fd; fd = open("fruit", O_WRONLY); write(fd, "apple", sizeof("apple")); close(fd); I compile it with $gcc test.c -o test and run as$ ./test Then I open the fruit file, and I see the following in the file: apple^@ What does the ^@ mean?...

## Why is backspace allowed in my jQuery whether I filter it out or not?

jquery,ascii,keypress,backspace

## NSData to NSString losing data

nsstring,ascii,nsdata,nsstringencoding
I'm attempting to convert a binary file into text, the problem is that a large portion of the file was not encoded in ascii and ends up being special characters. I'm using [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; but am only getting a few characters back in a 20000 byte data block....

## Why JDK8's Base64 uses ISO-8859-1?

character-encoding,base64,ascii,java-8,iso-8859-1
I'm writing my own BASE64 encoder/decoder for some constrained environments. And I found that Base64.Encoder#encodeString saying that it uses ISO-8859-1 for construct a String from those encoded bytes. I perfectly presuming that ISO-8859-1 charset also covers all base64 alphabets. Is there any possible reason not to use US-ASCII?...

## What's the simplest way to convert from a String to an ascii value in Swift?

string,swift,ascii
I just want to get the ascii value of a single char string in Swift. This is how I'm currently doing it: var singleChar = "a" println(singleChar.unicodeScalars[singleChar.unicodeScalars.startIndex].value) //prints: 97 This is so ugly though. There must be a simpler way....

## Buffered Writer unable to process from array [closed]

java,arrays,ascii,filewriter,bufferedwriter
I am using a bufferedwriter to write to a file from an array: int[] scores = new int[5]; for (int i = 0; i < 5; i++) { scores[i] = 2; //Array of twos } try { BufferedWriter output = new BufferedWriter(new FileWriter(new File("Scores.txt"))); output.flush(); for (int i = 0;...

## Regex to match ASCII Table character with decimal value

regex,decimal,ascii
So I need a Regex to match the ASCII character STX(Start Of Text) which is number 2 on ASCII Table. I tried ^ as Regex101.com suggest for start of text but it was unsuccessful. Then I tried [[:ascii:]] which was matching for all ASCII characters. Is there any way to...

## Normalise ASCII numbers to digit numbers

ascii,rust,bytestring
Running example: http://is.gd/NBpvmH fn main() { show({ let number = b"123456"; for sequence in number.windows(6) { let product = sequence.iter().fold(1, |a, &b| a * (b as u64)); println!("product of {:?} is {}", sequence, product); } }); } Instead of having an output like "product of [49, 50, 51, 52, 53,...

## Converting a binary string to an ascii string, the long way (No API Functions)

java,algorithm,binary,ascii
I had an interview recently and discovered that I'd forgotten some of the basics. I've been playing around again and have written a function that will take a binary string (there is no validation yet) and returns the ascii representation of said string. I'm looking for advice or tips on...

## C: Reading a file to keep track of each extended ASCII appearance count

c,ascii
I am currently trying to read the count of each character in a file. The file is encrypted so it contains ascii values 0 to 255. My ultimate goal is to return the character that appeared the most. The Problem After reading through the file I print the array for...

## Examining ASCII

c,gdb,ascii
How can I get the ASCII representation of hexadecimal values in the memory by examining in gdb? The gdb command x/[repeatCount] [memoryAddress] gives me hexadecimal 32-bit values starting at memoryAddress repeatCount times but I want the readable text/String which is represented by this data. How do I do that? This...

## Convert each letter of string into ascii values - java

java,string,ascii
I want to add two strings and remove duplicate characters of the string then I want to convert each letter of the string into ascii values. After converting, I want to add each letter ascii values and get a total amount of the values.. for ex: ab+ab ab // remove...

## Blender fbx import from ascii format

import,ascii,blender,fbx
I have a FBX model which I would like to open in Blender but when I try to import the model it says: ASCII FBX files are not supported. Is there a way to import the model to Blender somehow? I don't have access to any Autodesk software.

## Convert Binary File To String In Perl

perl,binary,hex,ascii
Ok. I have spent the last 14 hours trying to figure this out. I have a binary file with the following contents - (much more, but this is truncated version). I wish to convert this to readable string format. ^@^P<9A>^@^@^A^@^@И^@^@^A^@^@Κ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^F<9A>^@^@^@^@^@^@^C^@FQ]U:^@^M^@...

## Matching extended ASCII characters in .NET Regex

c#,regex,ascii,extended-ascii
I'm writing a .NET regular expression that needs to match all ASCII and extended ASCII characters except for control characters. To do this, I consulted the ASCII table and it seems that all these characters have an ASCII encoding of x20 to xFF. So I suppose [\x20-\xFF] should be able...

## Saving alphabet in array gets stack smashing error

c,char,ascii
This is a little simple program to save and show all the ASCII alphabet letters in an array: #include <stdio.h> int main(void) { int j = 0; char alpha[52]; for (i=65;i<=122;i++) { if (i<=90 || i>=97) { alpha[j] = i; } j++; } printf("\n"); return 0; } It gets the...

## How do I generate 8 different random numbers in python?

python,random,ascii
I'm trying to write an encryption program that generates 8 different random numbers and converts them to ASCII. If possible I'd like to use the 'random' function in python, but welcome other help. So far my code for generating the numbers is to assign a value to a different run...

## ASCII files get erased after opening in Python [closed]

python,csv,ascii
I started learning Python recently and came across of the following problem I open a ASCII fine for reading, say data.txt and try to print it to the screen. I am using this code: f = open("E:\ASCII\data.txt", "r") for line in f: print(repr(line)) This shows nothing on the screen, and...

## ASCII Space Character in Ruby Unicode Escape

ruby-on-rails,ruby,unicode,encoding,ascii
Doing some reading and came across this block of code on the topic of Unicode Escapes in Ruby: money = "\u{20AC 20 A3 20 A5}" # => "€ £ ¥" I understand that in this ruby syntax, the actual spaces between the {}'s doesn't output an encoded space, that's the...

## Java Conversion from ASCII Integer to Character yields unknown values

java,char,type-conversion,ascii
I have some Java code that should be very simple and straightforward, and unfortunately, I'm getting very odd results. Put simply, I'm doing a basic conversion from ASCII integers back into their string values. For instance, if I do: char n = (char) 152; System.out.print(n); // should yield: ÿ. Unfortunately,...

## Random HTML characters being encoded in emails

php,utf-8,ascii,html-email,quoted-printable
I'm generating an email with PHP that outputs an HTML table. Most of the table comes through fine, but some of the < and > characters are randomly encoded to &lt; and &gt;. It doesn't always do it in the same place. Sometimes it just happens in one place, sometimes...

## How do I convert a letter to an ASCII value? [closed]

java,char,ascii,value
Let's say char c = s How would I convert S into an ASCII value? ...

## In VBA, find n such that Chr(n) is greater than or equal to

vba,ascii,chr
Is there an n such that Chr(n) in Word VBA gives the greater than or equal to sign? Like Chr(150) is an m-dash (subtraction sign)?

## Unserialize objects from in-memory ASCII instead of from a file connection

json,r,serialization,ascii
Actual question How can I serialize objects to ASCII and unserialize them again from ASCII without having to write to and read from a file connection (i.e. from ASCII that is in-memory)? Background In a state-less client-server framework, I would like to make certain information persistent accross calls (serialize >>...

## Convert a String to binary sequence in C# with zero padding when not 8 bits of char

c#,string,character-encoding,char,ascii
I use this method which I saw in one of the questions to convert ascii to binary string: public string GetBits(string input) { StringBuilder sb = new StringBuilder(); foreach (byte b in ASCIIEncoding.UTF8.GetBytes(input)) { sb.Append(Convert.ToString(b, 2)); } return sb.ToString(); } But, If the input is something like the message bellow...

## changing letter into an encryption in java. simple call

java,syntax,ascii
What is the other way to change "a" to e.g."\n65" or other call in java which is based on ascii? this is not taught to java developers anymore but it was nice to know. i just forgot, but i need to use it for our project

## Convert ASCII file to Decimal file

c#,file,decimal,ascii
Hello I have a textfile with (ASCII or other format i don't know maybe UTF or UNICODE) text. In this file are special letters. I want to convert all letters, the complete file into DECIMAL. I just don't know how. private void simpleButton1_Click(object sender, EventArgs e) { int size =...

## Matlab: Read textfile with a mix of floats, integers and strings in the same column

matlab,data,ascii
loading a well formatted and delimited text file in Matlab is relatively simple, but I struggle with a text file that I have to read in. Sadly I can not change the structure of the source file, so I have to deal with what I have. The basic file structure...

## Conversion from char to int and printing the decimal value

c,char,printf,decimal,ascii
char str[20]; printf("Enter anything\n"); scanf("%s",str); for(int i = 0 ; i<strlen(str) ; i++) { if( isdigit(str[i])) printf("%d",(int)str[i]); } I tried with the above code but the output is in ASCII values of the numbers rather then actual numbers. Like , input: "0" output: "48". When I try (int)(str[i]-'0'); instead of...

## code gives out ASCII numbers instead of characters

c++,char,ascii,red-black-tree
This code is part of a RedBlack Tree program supposed to receive "ADSOMERT" and sort its characters into Inorder form "A D E M O R S T". It does the job, but with the ASCII numbers of each character "65 68 69 77 79 82 83 84". Main function:...

## Traceback from a Python Script: invalid literal

python,ascii,traceback
In short, what the Python script is supposed to do is to load and calculate ASCII type files. With some previously pre-processed files, it works without errors, while with mine it throws an error. In any case, it looks as though my file is different from what it should be...

## Conversion to ASCII

ascii,lexical-analysis
#include <iostream> #include<string.h> #include<cstring> #include<ctype.h> using namespace std; char *Data1[100]; char *operators[20]; char *identifiers[20][20]; int ascii[100] = {0}; int ascii2[100] = {0}; unsigned int Tcount = 0; unsigned int i; int main(void) { char *text = (char*)malloc ( 100 *sizeof( char)); cout << "Enter the first arrangement of data." <<...

## What base is ASCII?

javascript,ascii
I'm trying to make a small JavaScript program where the user inputs a decimal value, and that value is converted to ASCII and given back to the user. I need to find out what base ASCII is so I can type: (User's input).toString(ASCII's base); Thank you....

## How to print the ASCII value of a int in C++?

c++,ascii
I'm beginner in c++ and I want to write a program that prints the ASCII value of the alphabet ('a', 'b',.... 'z') and of the numbers ('0'...'9'). I'm able to print the ASCII value of the alphabet using the "int()" function. Example: char a = 'a'; std::cout<<int(a); The result of...