fspr_arch_utf8.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef UTF8_H
  17. #define UTF8_H
  18. #include "fspr.h"
  19. #include "fspr_lib.h"
  20. #include "fspr_errno.h"
  21. /* If we ever support anything more exciting than char... this could move.
  22. */
  23. typedef fspr_uint16_t fspr_wchar_t;
  24. /**
  25. * An APR internal function for fast utf-8 octet-encoded Unicode conversion
  26. * to the ucs-2 wide Unicode format. This function is used for filename and
  27. * other resource conversions for platforms providing native Unicode support.
  28. *
  29. * @tip Only the errors APR_EINVAL and APR_INCOMPLETE may occur, the former
  30. * when the character code is invalid (in or out of context) and the later
  31. * when more characters were expected, but insufficient characters remain.
  32. */
  33. APR_DECLARE(fspr_status_t) fspr_conv_utf8_to_ucs2(const char *in,
  34. fspr_size_t *inbytes,
  35. fspr_wchar_t *out,
  36. fspr_size_t *outwords);
  37. /**
  38. * An APR internal function for fast ucs-2 wide Unicode format conversion to
  39. * the utf-8 octet-encoded Unicode. This function is used for filename and
  40. * other resource conversions for platforms providing native Unicode support.
  41. *
  42. * @tip Only the errors APR_EINVAL and APR_INCOMPLETE may occur, the former
  43. * when the character code is invalid (in or out of context) and the later
  44. * when more words were expected, but insufficient words remain.
  45. */
  46. APR_DECLARE(fspr_status_t) fspr_conv_ucs2_to_utf8(const fspr_wchar_t *in,
  47. fspr_size_t *inwords,
  48. char *out,
  49. fspr_size_t *outbytes);
  50. #endif /* def UTF8_H */