Search Results

Search found 1693 results on 68 pages for 'ascii'.

Page 5/68 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • C Newbie, ascii control function

    - by user570607
    Hey there, I have written a program that works well in C that converts non-readable ASCII to their character values. I would appreciate if a C master? would show me a better way of doing it that I have currently done, mainly this section: if (isascii(ch)) { switch (ch) { case 0: printControl("NUL"); break; case 1: printControl("SOH"); break; .. etc (32 in total) case default: putchar(ch); break; } } Is it normal to make a switch that big? Or should I be using some other method (input from an ascii table?)

    Read the article

  • FTP ASCII file from Windows to Mainframe (iSeries) — special characters

    - by MikeM
    I have a text file created on a Windows machine, the page coding used on the file is 1252 This file is then ftp'd to an iSeries machine for processing As far as I can see, it appears on the iSeries. It has a CCSID of 037. Sometimes this file contains French characters (e.g. é). When this happens, the FTP will fail with a truncation error as the french character gets converted to some extra junk: �. The file is fixed block so the line does get truncated due to the one character turning into 3. I can convert the French characters to characters without the accents before sending but would prefer to keep everything intact. So is there a way to retain them and send the file over properly? I'm very green on iSeries, mainly a Windows guy.

    Read the article

  • UnicodeEncodeError: 'ascii' codec can't encode character [...]

    - by user1461135
    I have read the HOWTO on Unicode from the official docs and a full, very detailed article as well. Still I don't get it why it throws me this error. Here is what I attempt: I open an XML file that contains chars out of ASCII range (but inside allowed XML range). I do that with cfg = codecs.open(filename, encoding='utf-8, mode='r') which runs fine. Looking at the string with repr() also shows me a unicode string. Now I go ahead and read that with parseString(cfg.read().encode('utf-8'). Of course, my XML file starts with this: <?xml version="1.0" encoding="utf-8"?>. Although I suppose it is not relevant, I also defined utf-8 for my python script, but since I am not writing unicode characters directly in it, this should not apply here. Same for the following line: from __future__ import unicode_literals which also is right at the beginning. Next thing I pass the generated Object to my own class where I read tags into variables like this: xmldata.getElementsByTagName(tagName)[0].firstChild.data and assign it to a variable in my class. Now what perfectly works are those commands (obj is an instance of the class): for element in obj: print element And this command does work as well: print obj.__repr__() I defined __iter__() to just yield every variable while __repr__() uses the typical printf stuff: "%s" % self.varname Both commands print perfectly and can output the unicode character. What does not work is this: print obj And now I am stuck because this throws the dreaded UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 47: So what am I missing? What am I doing wrong? I am looking for a general solution, I always want to handle strings as unicode, just to avoid any possible errors and write a compatible program. Edit: I also defined this: def __str__(self): return self.__repr__() def __unicode__(self): return self.__repr__() From documentation I got that this

    Read the article

  • Is this an acceptable use of "ASCII arithmetic"?

    - by jmgant
    I've got a string value of the form 10123X123456 where 10 is the year, 123 is the day number within the year, and the rest is unique system-generated stuff. Under certain circumstances, I need to add 400 to the day number, so that the number above, for example, would become 10523X123456. My first idea was to substring those three characters, convert them to an integer, add 400 to it, convert them back to a string and then call replace on the original string. That works. But then it occurred to me that the only character I actually need to change is the third one, and that the original value would always be 0-3, so there would never be any "carrying" problems. It further occurred to me that the ASCII code points for the numbers are consecutive, so adding the number 4 to the character "0", for example, would result in "4", and so forth. So that's what I ended up doing. My question is, is there any reason that won't always work? I generally avoid "ASCII arithmetic" on the grounds that it's not cross-platform or internationalization friendly. But it seems reasonable to assume that the code points for numbers will always be sequential, i.e., "4" will always be 1 more than "3". Anybody see any problem with this reasoning? Here's the code. string input = "10123X123456"; input[2] += 4; //Output should be 10523X123456

    Read the article

  • Can URIs have non-ASCII characters?

    - by Cheeso
    I tried to find this in the relevant RFC, IETF RFC 3986, but couldn't figure it. Do URIs for HTTP allow Unicode, or non-ASCII of any kind? Can you please cite the section and the RFC that supports your answer. NB: For those who might think this is not programming related - it is. It's related to an ISAPI filter I'm building.

    Read the article

  • Replace diacritic characters with "equivalent" ASCII in PHP?

    - by Dolph Mathews
    Related questions: http://stackoverflow.com/questions/2653739/how-to-replace-characters-in-a-java-string http://stackoverflow.com/questions/2393887/how-to-replace-special-characters-with-their-equivalent-such-as-a-for-a As in the questions above, I'm looking for a reliable, robust way to reduce any unicode character to near-equivalent ASCII using PHP. I really want to avoid rolling my own look up table. For example (stolen from 1st referenced question): Gracišce becomes Gracisce

    Read the article

  • Converting Unicode strings to escaped ascii string

    - by Ali
    How can I convert this string: This string contains the unicode character Pi(p) into an escaped ascii string: This string contains the unicode character Pi(\u03a0) and vice versa ? The current Encoding available in C#, converts the p character into "?". I need to preserve that character.

    Read the article

  • Need to convert string/char to ascii values.

    - by SA
    Hi, I need to convert char to hex values. Refer to the Ascii table but I have a few examples listed below: char 1 = 31 2 = 32 3 = 33 4 = 34 5 = 35 A = 41 a = 61 etc Therefore string str = "12345"; Need to get the converted str = "3132333435"

    Read the article

  • ASCII Diagram Tool

    - by Jon
    I'm looking for an ASCII diagram tool for producing diagrams from text. I only really need sequence and state type diagrams for now, but I'm curious as to what people would recommend? I need something which is standalone, not a web based tool that works on Linux, OSX and Windows.

    Read the article

  • Ascii art generator for iPhone ?

    - by raaz
    Hi all, I want to devlop an application for iPhone which will convert the png image present in iPhone to an Ascii image. Any guidance to devlop such an application ? Is there any API/Library available for this ?

    Read the article

  • How Do I grep For non-ASCII Characters in UNIX

    - by Peter Conrey
    I have several very large XML files and I'm trying to find the lines that contain non-ASCII characters. I've tried the following: grep -e "[\x{00FF}-\x{FFFF}]" file.xml But this returns every line in the file, regardless of whether the line contains a character in the range specified. Do I have the syntax wrong or am I doing something else wrong? I've also tried: egrep "[\x{00FF}-\x{FFFF}]" file.xml (with both single and double quotes surrounding the pattern).

    Read the article

  • Importing Ascii/Grid file with MapXtreme2008 ?

    - by cro
    We are looking at upgrading to MapXtreme2008 from MapX4.5/Vertical Mapper3 with the 60 days trial version. We are not able to import Ascii/Grid file with MapXtreme. We have try posting on the MapXtreme forum, but no answer so far. Thanks. http://en.wikipedia.org/wiki/ESRI_grid

    Read the article

  • PHP <-> JavaScript communication: Am I stuck with ASCII?

    - by Goro
    Hello, I am passing a lot of data between PHP and JavaScript. I am using JSON and json_encode in php, but the problem here is that I am passing a lot of numbers stored as strings - for example, numbers like 1.2345. Is there a way to pass the data directly as numbers (floats, integers) and not have to convert it to ASCII and then back? Thanks,

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >