• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Convert unicode string into ascii
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Convert unicode string into ascii


  • Subject: RE: Convert unicode string into ascii
  • From: "Gary L. Wade" <email@hidden>
  • Date: Fri, 29 Aug 2008 10:51:32 -0400

Maybe I'm missing something from your example, previous postings, and my ISP's web mail client, but it appears your desired output doesn't seem to match in character count to your original text.  Nevertheless, if all you want is to turn low-ASCII (values less than 0x20) and high-ASCII (values greater than 0x7F) into period characters, you'd find better performance and flexibility for your particular needs by simply writing a function that takes an unsigned 8-bit integer (e.g., in a loop, 0x01, 0x08, 0x0B, ..., 0x13) and returns the desired character.  In that function, do your test for low-ASCII and high-ASCII, returning the period character in those cases, and the supplied character in all other cases.  Since this code is pretty trivial, you could even inline it rather than code it into a separate function, but I don't know if you need to call it in more than one place in your code.

>yes, it is for a small hex reader.
>I need to read some old c64 file (.prg) then
>visualize the hex and the ascii
>so when I translate this:
>
>01 08 0B 08 01 00 9E 32 30 36 31 00 00 00 A9 93
>20 D2 FF A9 08 85 FC 8D 6B 10 A9 38 8D DC 17 A9
>30 8D DB 17 A9 37 85 01 A9 13
>
>I get this:
>
>î2061	ì¢PêàU(6ìà3!pj0É1	7Ö	 2U	É
>¢2êRPêÇP⁄	ÖP	ÖQP)U0B• ÇRÉe$ÄÄê
>00Q!)P)PE)•ê5ríÖ2íPê⁄É4BR Ñ
>B#x†1îX10$êRêX
>
>so,not nice looking string :)
>
>What I want to see after parsing is:
>
>..........2061......k..8.....0....7....
>
>etc etc_______________________________________________
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Convert unicode string into ascii
      • From: Davide Scheriani <email@hidden>
  • Prev by Date: Re: Image in NSOutlineView
  • Next by Date: What to use observeValueForKeyPath: context
  • Previous by thread: Convert unicode string into ascii
  • Next by thread: Convert unicode string into ascii
  • Index(es):
    • Date
    • Thread