For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2005 > ASCII -> ASCII printable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ASCII -> ASCII printable
Brano Gerzo

2005-11-26, 6:56 pm

Hi all,

I need convert all ASCII unprintalbe to ASCII printable (if possible)
according to (http://en.wikipedia.org/wiki/ASCII), tell me please,
what should I use/look for.

Thanks a lot.

Xavier Noria

2005-11-26, 6:56 pm

On Nov 26, 2005, at 19:21, Brano Gerzo wrote:

> I need convert all ASCII unprintalbe to ASCII printable (if possible)
> according to (http://en.wikipedia.org/wiki/ASCII), tell me please,
> what should I use/look for.


The string "\033" would be converted to what?

-- fxn

Brano Gerzo

2005-11-26, 6:56 pm

Xavier Noria [XN], on Saturday, November 26, 2005 at 20:20 (+0100)
typed the following:

[color=darkred]

XN> The string "\033" would be converted to what?

yes, on the first line I wrote "(if possible)", as you guess right,
this is not possible.
But for example (I write DEC numbers):
128 -> c
129 -> u
130 -> e
and so on (http://www.lookuptables.com/)

So I guess I'm looking for some conversion table, if this is not done,
I will create one, but never do this before, don't know what to use
:( hm, maybe tr will help here...

--

...m8s, cu l8r, Brano.

["Another classic walk-across-the-livingroom scene" -- Crow]


Xavier Noria

2005-11-26, 6:56 pm

On Nov 26, 2005, at 20:39, Brano Gerzo wrote:

> Xavier Noria [XN], on Saturday, November 26, 2005 at 20:20 (+0100)
> typed the following:
>
>
>
> XN> The string "\033" would be converted to what?
>
> yes, on the first line I wrote "(if possible)", as you guess right,
> this is not possible.
> But for example (I write DEC numbers):
> 128 -> c
> 129 -> u
> 130 -> e
> and so on (http://www.lookuptables.com/)
>
> So I guess I'm looking for some conversion table, if this is not done,
> I will create one, but never do this before, don't know what to use
> :( hm, maybe tr will help here...


Yeah, looks like you need some kind of conversion table, but I still
do no understand the problem to solve. Can you be more specific? Do
you have examples of actual inputs and their corresponding conversions?

-- fxn

Brano Gerzo

2005-11-26, 6:56 pm

Xavier Noria [XN], on Saturday, November 26, 2005 at 20:53 (+0100)
thinks about :

XN> Yeah, looks like you need some kind of conversion table, but I still
XN> do no understand the problem to solve. Can you be more specific? Do
XN> you have examples of actual inputs and their corresponding conversions?

this is selfexplain: http://www.lookuptables.com/
when the character is possible to convert to something printable, I
can write conversion (161 -> i), but for example 241 has no printable
character, so it should be space or nothing.

As I look to these codes, I found around 36 characters, which I should
convert.

And need for this? I'm sending to client some file, but name of
attachment is created from database. In DB I have iso-8859-1
characters, which looks ugly (I don't know client's encoding, I don't
know how to encode filename of attachment...), so I just want send
clear characters....

--

...m8s, cu l8r, Brano.

[DISCLAIMER: I really shouldn't respond to my mail before I have my
beer.]


Xavier Noria

2005-11-26, 6:56 pm

On Nov 26, 2005, at 21:03, Brano Gerzo wrote:

> Xavier Noria [XN], on Saturday, November 26, 2005 at 20:53 (+0100)
> thinks about :
>
> XN> Yeah, looks like you need some kind of conversion table, but I
> still
> XN> do no understand the problem to solve. Can you be more
> specific? Do
> XN> you have examples of actual inputs and their corresponding
> conversions?
>
> this is selfexplain: http://www.lookuptables.com/
> when the character is possible to convert to something printable, I
> can write conversion (161 -> i), but for example 241 has no printable
> character, so it should be space or nothing.


Ok, there are not enough details to provide actual code, but I think
you'll be done with tr///, it is documented in perlop.

-- fxn

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com