Re: detecting ASCII/EBCDIC

Discussion in 'C Programming' started by Jean-Marc Bourguet, Sep 3, 2008.

  1. Eric Sosman <> writes:

    > Pilcrow wrote:
    > > On Tue, 02 Sep 2008 15:11:49 -0700, Pilcrow <> wrote:
    > >
    > >> Is there a way that a proram can detect whether it is operating in an
    > >> ASCII or an EBCDIC environment?

    > > OK, it seems I have my answer: if('i' + 1 != 'j') we definitely don't
    > > have ASCII. Most likely we have some flavor of EBCDIC. But, since the
    > > compiler will have been compiled in either the ASCII or the EBCDIC
    > > environment, it seems that there could have been some macro that would
    > > have told us so directly.

    >
    > I don't see how. When you take into account the fact that
    > things like "code pages" can change at run-time, the compiler
    > seems at a disadvantage in trying to predict them ...


    ISTR that the characters in the basic characters set have their code the
    same in all supported locale (ie you can't have support for both a
    EBCDIC-based and a ASCII-based locale without having one of them remap the
    characters).

    Yours,

    --
    Jean-Marc
     
    Jean-Marc Bourguet, Sep 3, 2008
    #1
    1. Advertising

  2. Jean-Marc Bourguet

    osmium Guest

    "Eric Sosman" writes:

    > If the question is restricted to the encoding of the
    > basic execution set -- the characters that the Standard
    > requires to be present -- then a straightforward exhaustive
    > test can determine whether the encoding for those characters
    > is "consistent with ASCII" or "consistent with EBCDIC" or
    > "consistent with neither." But is that enough for the O.P.?
    > Again, yet again, we get back to the question: What is he
    > *really* trying to find out, and why? (Since the question
    > has been asked at least four times by at least three people
    > and has elicited no answer, I'm beginning to think he doesn't
    > know.)


    My guess is that he is one of those annoying (to many of the regulars on
    this froup) curious guys who just likes to know things.

    Pretty pathetic, huh?
     
    osmium, Sep 4, 2008
    #2
    1. Advertising

  3. Jean-Marc Bourguet

    Richard Bos Guest

    "osmium" <> wrote:

    > "Eric Sosman" writes:
    >
    > > If the question is restricted to the encoding of the
    > > basic execution set -- the characters that the Standard
    > > requires to be present -- then a straightforward exhaustive
    > > test can determine whether the encoding for those characters
    > > is "consistent with ASCII" or "consistent with EBCDIC" or
    > > "consistent with neither." But is that enough for the O.P.?
    > > Again, yet again, we get back to the question: What is he
    > > *really* trying to find out, and why? (Since the question
    > > has been asked at least four times by at least three people
    > > and has elicited no answer, I'm beginning to think he doesn't
    > > know.)

    >
    > My guess is that he is one of those annoying (to many of the regulars on
    > this froup) curious guys who just likes to know things.
    >
    > Pretty pathetic, huh?


    No, he's one of those annoying not-quite-curious-enough guys who doesn't
    know _what_ he wants to know, he just likes to ask half-baked questions.

    And yes, that's pretty pathetic.

    Richard
     
    Richard Bos, Sep 4, 2008
    #3
  4. "osmium" <> writes:
    > "Eric Sosman" writes:
    >> If the question is restricted to the encoding of the
    >> basic execution set -- the characters that the Standard
    >> requires to be present -- then a straightforward exhaustive
    >> test can determine whether the encoding for those characters
    >> is "consistent with ASCII" or "consistent with EBCDIC" or
    >> "consistent with neither." But is that enough for the O.P.?
    >> Again, yet again, we get back to the question: What is he
    >> *really* trying to find out, and why? (Since the question
    >> has been asked at least four times by at least three people
    >> and has elicited no answer, I'm beginning to think he doesn't
    >> know.)

    >
    > My guess is that he is one of those annoying (to many of the regulars on
    > this froup) curious guys who just likes to know things.
    >
    > Pretty pathetic, huh?


    No, not at all.

    But a question asked for the sake of curiosity might have a different
    answer than the very same question asked for the sake of accomplishing
    some specific task, so actually telling us why he wants to know could
    make it a lot easier for us to provide the answer he wants.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Sep 4, 2008
    #4
  5. Pilcrow <> writes:

    > Sometimes you don't know what you want to learn until you've learned it.
    > -- Catch-22.


    That's why some are asking you the problem you want to solve instead of
    giving you 42 different ways of achieving something which could even not be
    part of the correct solution.

    Yours,

    --
    Jean-Marc
     
    Jean-Marc Bourguet, Sep 4, 2008
    #5
  6. Jean-Marc Bourguet

    James Kuyper Guest

    Pilcrow wrote:
    > On Thu, 04 Sep 2008 06:40:18 GMT, (Richard
    > Bos) wrote:
    >
    >> "osmium" <> wrote:

    ....
    >>> My guess is that he is one of those annoying (to many of the regulars on
    >>> this froup) curious guys who just likes to know things.
    >>>
    >>> Pretty pathetic, huh?

    >> No, he's one of those annoying not-quite-curious-enough guys who doesn't
    >> know _what_ he wants to know, he just likes to ask half-baked questions.
    >>
    >> And yes, that's pretty pathetic.
    >>
    >> Richard

    >
    > Sometimes you don't know what you want to learn until you've learned it.


    That's why you're being asked about the purpose of your question. No
    matter how little you know about a subject, if you are asking questions
    about it, you should at least know what your purpose was for asking the
    questions. It is, after all, your purpose - if you don't know what it
    was, you didn't have one, in which case you wouldn't have bothered asking.

    For instance, yesterday my wife (a non-native speaker of English) asked
    me what some word (I think it was "eftr") meant. I didn't recognize the
    word. so I asked her why she wanted to know. She explained that she was
    reading a document which referred to a given strain of bacteria as "EFTR
    code 54321" (that is not the actual code). I immediately recognized,
    from context, that EFTR was not a word, but an abbreviation for
    something (I still don't know what) that assigns codes to bacterial
    strains. My wife didn't know what it was she needed to ask, but by
    knowing why she wanted to know it, I was able to tell her that she
    needed to find out what EFTR was an abbreviation for.
     
    James Kuyper, Sep 4, 2008
    #6
  7. In article <>,
    Keith Thompson <> wrote:
    ....
    >No, not at all.


    Yes. Quite. Osmium hit the bullseye here. The regs don't like it.

    >But a question asked for the sake of curiosity might have a different
    >answer than the very same question asked for the sake of accomplishing
    >some specific task, so actually telling us why he wants to know could
    >make it a lot easier for us to provide the answer he wants.


    Blah, blah, blah.
     
    Kenny McCormack, Sep 4, 2008
    #7
  8. Jean-Marc Bourguet

    osmium Guest

    "Eric Sosman" wrote:

    > osmium wrote:
    >> "Eric Sosman" writes:
    >>
    >>> If the question is restricted to the encoding of the
    >>> basic execution set -- the characters that the Standard
    >>> requires to be present -- then a straightforward exhaustive
    >>> test can determine whether the encoding for those characters
    >>> is "consistent with ASCII" or "consistent with EBCDIC" or
    >>> "consistent with neither." But is that enough for the O.P.?
    >>> Again, yet again, we get back to the question: What is he
    >>> *really* trying to find out, and why? (Since the question
    >>> has been asked at least four times by at least three people
    >>> and has elicited no answer, I'm beginning to think he doesn't
    >>> know.)

    >>
    >> My guess is that he is one of those annoying (to many of the regulars on
    >> this froup) curious guys who just likes to know things.
    >>
    >> Pretty pathetic, huh?

    >
    > You may find Pilcrow pathetic and annoying, but I don't.


    I'll bet you failed Sarcasm 101.
     
    osmium, Sep 4, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sylvain

    EBCDIC ascii conversion?

    Sylvain, Jun 13, 2004, in forum: Java
    Replies:
    2
    Views:
    21,933
    Thomas Weidenfeller
    Jun 14, 2004
  2. Re: detecting ASCII/EBCDIC

    , Sep 2, 2008, in forum: C Programming
    Replies:
    3
    Views:
    394
  3. Antoninus Twink

    Re: detecting ASCII/EBCDIC

    Antoninus Twink, Sep 2, 2008, in forum: C Programming
    Replies:
    2
    Views:
    350
    Richard
    Sep 3, 2008
  4. Keith Thompson

    Re: detecting ASCII/EBCDIC

    Keith Thompson, Sep 3, 2008, in forum: C Programming
    Replies:
    2
    Views:
    334
    Keith Thompson
    Sep 3, 2008
  5. Re: detecting ASCII/EBCDIC

    , Sep 3, 2008, in forum: C Programming
    Replies:
    4
    Views:
    385
Loading...

Share This Page