ascii

How to convert a string from utf8 to ASCII (single byte) in c#?

I have a string object "with multiple characters and even special characters" I am trying to use UTF8Encoding utf8 = new UTF8Encoding(); ASCIIEncoding ascii = new ASCIIEncoding(); objects in order to convert that string to ascii. May I ask someone to bring some light to this simple task, that is hunting my afternoon. EDIT 1: What...

Differentiating between "AB" and "Ab" in a character Database Field

Specifically, Sql Server 2005/T-Sql. I have a field that is mostly a series of two characters, and they're all supposed to be upper case but there's some legacy data that predates the current DB/System, and I need to figure out which records are in violation of the upper casing covenant. I thought this would work: select * from tbl wh...

Convert escaped html ASCII codes to plain text using JavaScript

I'm looking to convert a string of html entities specifying ASCII codes (ie: a) to the ASCII characters they represent (ie: a). I'm using a property of an object and trying to assign a value. For instance: object.Text(""); When I pass is the string representing the entity, I get the same string back. I can't find the function to c...

How do I convert LaTeX to plain-text (ASCII)?

Scenario: I have a document I created using LaTeX (my resume in this case), it's compiling in pdflatex correctly and outputting exactly what I'd like. Now I need the same document to be converted to plain old ASCII. Example: I have seen this done (at least once) here, where the author has a PDF version and an ASCII version that matche...

How do I distinguish between 'binary' and 'text' files?

This is a duplicate of http://stackoverflow.com/questions/277521/how-to-identify-the-file-content-is-in-ascii-or-binary, but since I don't have the rep, I can't edit that question to improve it. Informally, most of us understand that there are 'binary' files (object files, images, movies, executables, proprietary document formats, etc) ...

How can I decode HTML entities?

Here's a quick Perl question: How can I convert HTML special characters like ü or ' to normal ASCII text? I started with something like this: s/\&#(\d+);/chr($1)/eg; and could write it for all HTML characters, but some function like this probably already exists? Note that I don't need a full HTML->Text converter. I alrea...

Java newbie: Swing and displaying ASCII files

G'day all, I have an application which needs to display an ASCII file of 15 lines in a Swing component that cannot be edited by the user. Below is my code which reads the ASCII file byte by byte. My thanks to the helpful commenters who explained that a JTextArea.setEditable(false) would be appropriate in Swing. However, my code mer...

Oracle: Pattern for to_char(number) to add additional ascii characters?

Using the Oracle to_char(number) function, is it possible to append ascii characters to the returned string? Specifically, I need to add a percentage character to the returned string. "select to_char(89.2244, '999G999G999G999G990D00') from dual" --> returns "89.22". I need a format pattern that returns "89.22%". I am using this throug...

How do I get the byte values of a string in PHP?

Say I have a string in php, that prints out to a text file like this: nÖ§9q1Fª£ How do I get the byte codes of this to my text file rather than the funky ascii characters? ...

Python string prints as u['String']

Hi there, This will surely be an easy one but it is really bugging me. I have a script that reads in a webpage and uses BeutifulSoup to parse it. From the soup I extract all the links as my final goal is to print out the link.contents. All off the text that I am parsing is ASCII. I know that python treats strings as unicode, and I am...

How does one write the hex values of a char in ASCII to a text file?

Here is what I currently have so far: void WriteHexToFile( std::ofstream &stream, void *ptr, int buflen, char *prefix ) { unsigned char *buf = (unsigned char*)ptr; for( int i = 0; i < buflen; ++i ) { if( i % 16 == 0 ) { stream << prefix; } stream << buf[i] << ' '; } } I've tried doing stream.hex, str...

Need help with converting characters to ASCII code in VB code

Need help with reading special characters within my VB code. ASCII code Char(34) = " works fine but Char(60) = < and Char(62) = > are not being read. My Code node.FirstChild.InnerText = Chr(60) & "httpRuntime executionTimeout=" & Chr(34) & "999999" & Chr(34) & " maxRequestLength=" & Chr(34) & "2097151" & Chr(34) & "/" & Chr(62) With...

What is the difference between EM Dash #151; and #8212;?

I've an ASCII file that contains an EM Dash (— or &mdash; in HTML). The hex value is 0x97. When we pass this file through one application it arrives as UTF-8, and it converts the character to 0xC297, which is &#151; in HTML. However, when we pass this file through a different application it converts the character to 0xE28094 or &#8212;. ...

How can I convert non-ASCII characters encoded in UTF8 to ASCII-equivalent in Perl?

I have a Perl script that is being called by third parties to send me names of people who have registered my software. One of these parties encodes the names in UTF-8, so I have adapted my script accordingly to decode UTF-8 to ASCII with Encode::decode_utf8(...). This usually works fine, but every 6 months or so one of the names contai...

How can I download a utf-8-encoded web page with libcurl, preserving the encoding?

Im trying to get libcurl to download a webpage that is encoded in UTF-8, which is working fine, except for the fact that it converts it to ASCII and screws up some of the characters. Is there an easy way to get it to keep it in UTF-8? ...

bash: how do I write non ascii chars using echo?

Is there an escape sequence, such as \012 or something like that? I want to append on ascii chars to a file using echo ?? >> file ...

Unicode, UTF, ASCII, ANSI format differences

whatis the difference between Unicode, UTF8, UTF7,UTF16,UTF32,ASCII, ANSI code format of encoding in ASP.net In what these are helpful for programmers. ...

Need a list of languages that are supported completely by ASCII encoding.

I am writing an article on Unicode and discussing the advantages of this encoding scheme over outdated methods like ASCII. As part of my research I am looking for a reference that listed the languages that could be fully represented using only the characters supported by ASCII. Haven't had much luck tracking it down with Google and I t...

VB Replace problem with HTML ascii codes

So I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti = Replace(teksti, "<", "& lt;") teksti = Replace(teksti, ">", "& gt;") teksti = Replace(teksti, """", "& quot;") teksti = Replace(teksti, "'", "& #8217;") teksti = Replace(teksti, "%", "& #37;") teksti = Replace(teksti, "&", "& amp;") teksti = Repla...

sshfs EBCDIC to ASCII

Hi all, what I want to do is to be able to mount via sshfs some files on the mainframe via USS on my local PC. I can do that but sshfs doesnt do straight off the conversion from EBCDIC to ascii/unicode. Is there any flags that i can set. Alternativly, does anybody know of a library that does EBCDIC to ASCII conversions so i can add to...