LICENSE_unicode.txt 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright 2001-2004 Unicode, Inc.
  3. *
  4. * Disclaimer
  5. *
  6. * This source code is provided as is by Unicode, Inc. No claims are
  7. * made as to fitness for any particular purpose. No warranties of any
  8. * kind are expressed or implied. The recipient agrees to determine
  9. * applicability of information provided. If this file has been
  10. * purchased on magnetic or optical media from Unicode, Inc., the
  11. * sole remedy for any claim will be exchange of defective media
  12. * within 90 days of receipt.
  13. *
  14. * Limitations on Rights to Redistribute This Code
  15. *
  16. * Unicode, Inc. hereby grants the right to freely use the information
  17. * supplied in this file in the creation of products supporting the
  18. * Unicode Standard, and to make copies of this file in any form
  19. * for internal or external distribution as long as this notice
  20. * remains attached.
  21. */
  22. /* ---------------------------------------------------------------------
  23. Conversions between UTF32, UTF-16, and UTF-8. Header file.
  24. Several funtions are included here, forming a complete set of
  25. conversions between the three formats. UTF-7 is not included
  26. here, but is handled in a separate source file.
  27. Each of these routines takes pointers to input buffers and output
  28. buffers. The input buffers are const.
  29. Each routine converts the text between *sourceStart and sourceEnd,
  30. putting the result into the buffer between *targetStart and
  31. targetEnd. Note: the end pointers are *after* the last item: e.g.
  32. *(sourceEnd - 1) is the last item.
  33. The return result indicates whether the conversion was successful,
  34. and if not, whether the problem was in the source or target buffers.
  35. (Only the first encountered problem is indicated.)
  36. After the conversion, *sourceStart and *targetStart are both
  37. updated to point to the end of last text successfully converted in
  38. the respective buffers.
  39. Input parameters:
  40. sourceStart - pointer to a pointer to the source buffer.
  41. The contents of this are modified on return so that
  42. it points at the next thing to be converted.
  43. targetStart - similarly, pointer to pointer to the target buffer.
  44. sourceEnd, targetEnd - respectively pointers to the ends of the
  45. two buffers, for overflow checking only.
  46. These conversion functions take a ConversionFlags argument. When this
  47. flag is set to strict, both irregular sequences and isolated surrogates
  48. will cause an error. When the flag is set to lenient, both irregular
  49. sequences and isolated surrogates are converted.
  50. Whether the flag is strict or lenient, all illegal sequences will cause
  51. an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
  52. or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
  53. must check for illegal sequences.
  54. When the flag is set to lenient, characters over 0x10FFFF are converted
  55. to the replacement character; otherwise (when the flag is set to strict)
  56. they constitute an error.
  57. Output parameters:
  58. The value "sourceIllegal" is returned from some routines if the input
  59. sequence is malformed. When "sourceIllegal" is returned, the source
  60. value will point to the illegal value that caused the problem. E.g.,
  61. in UTF-8 when a sequence is malformed, it points to the start of the
  62. malformed sequence.
  63. Author: Mark E. Davis, 1994.
  64. Rev History: Rick McGowan, fixes & updates May 2001.
  65. Fixes & updates, Sept 2001.
  66. ------------------------------------------------------------------------ */