Re: how to get rid of a character, 0x80?



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@xxxxxxxxx> 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@xxxxxxxxx


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@xxxxxxxxxxx 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

_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: doubly-linked list & sorting
    ... char Emess; ... diff = -1; ...
    (comp.lang.c)
  • Re: Mathematics of the Enigma cipher?
    ... A character is mapped to an integer which becomes ... All the Rotors should be advanced ... char val3=R2.GetCharacterIndex; ... I thought the Reflector was fixed. ...
    (comp.programming)
  • Re: Mathematics of the Enigma cipher?
    ... A character is mapped to an integer which becomes ... All the Rotors should be advanced ... char val3=R2.GetCharacterIndex; ... I thought the Reflector was fixed. ...
    (comp.programming)
  • Re: Pointer
    ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it pointing to a "Single byte character" array or is it pointing to something else? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Pointer
    ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it ...
    (microsoft.public.dotnet.languages.csharp)