Re: Another Querry

From: Antoine Leca (Antoine10646@leca-marti.org)
Date: Wed Nov 24 2004 - 03:05:26 CST

  • Next message: kefas: "CGJ , RLM"

    On Wednesday, November 24th, 2004 04:02Z Harshal Trivedi va escriure:

    > How can i determine end of UCS-2/UCS-4 string while encoding it in C
    > program?

    It depends how you are storing and more importantly managing it.

    If you consider it as mere arrays of uint16_t/uint32_t, with your own
    functions to do any processing you want, you can use whatever ways to know
    'end of strings' that is convenient to you: either store a marker (one can
    think at U+FFFF for that), or registering the size of the array, or even
    doing both things.
    If you want to go this way and still have no code written, you should really
    have a look at ICU, basically it is/was a library that did exactly these
    kind of things for you.

    On the other hand, if you want to take advantage of the resources the C
    library are offering, perhaps your platform already has some kind of UCS
    encoding available (read section 5.2 of The Unicode Standard as a starting
    point), then there are no real difference than with plain strings: 0 is used
    to flag the end of a string.

    Antoine



    This archive was generated by hypermail 2.1.5 : Wed Nov 24 2004 - 03:07:30 CST