how to get rid of a character, 0x80?
Gary Kline
kline at thought.org
Tue Sep 8 19:21:45 UTC 2009
On Tue, Sep 08, 2009 at 08:02:06AM -0500, Jim White wrote:
> On Tue, Sep 8, 2009 at 7:43 AM, Jon Radel <jon at radel.com> wrote:
>
> > Mark Stapper wrote:
> >
> > besides.. 0x80!=0200
> >> it's 0200 octal which is 128 decimal...
> >> Might be why it doesn't work for you.
> >>
> >
> > Don't mess with his head. ;-)
> >
> > 0200 = 0x80 = 128
> >
> > 200 octal = 80 hex = 128 decimal
> >
Yup :-)
> >
> > --Jon Radel
> > jon at radel.com
> >
>
> You may want to check if your char type is signed. If it is (and it just
> happens to be 8 bits wide), (char)128 is a negative value.
I used
int ch, not char ch;
Also, just found some throwaway code that [of course] never gets pitched, and
found the for chars >= 128, it's a wide character.
while (( ch = getwc(stdin)) != WEOF)
{
if (ch == L'\xe2')
{
if ((ch1 = getwc(stdin)) == L'\x80')
{
printf("'");
/* check for and swallow last of the trio */
if ((ch2 = getwc(stdin)) == L'\x90')
{
continue;
}
}
}
else
{
putchar (ch);
}
}
I wrote the above to get rid of openoffice TXT that was still cluttered with the
trio of wide characters that output one apostrophe.
Last night I used pdftotext to translate a pdf file; it was cluttered with a slew of
^L's, which == '\014', and wound up with a greater slew of <x80> in more [less]
and vi. Nutshell, the file was fubar'd.
gary
--
Gary Kline kline at thought.org http://www.thought.org Public Service Unix
http://jottings.thought.org http://transfinite.thought.org
The 5.67a release of Jottings: http://jottings.thought.org/index.php
More information about the freebsd-questions
mailing list