# Adding char\* based APIs for Unix

**URL:** <https://discuss.python.org/t/adding-char-based-apis-for-unix/916>\
**Category:** Python Help\
**Created:** [February 20, 2019, 3:53am UTC](https://discuss.python.org/t/adding-char-based-apis-for-unix/916 "2019-02-20T03:53:39Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![methane](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/methane/32/43_2.png) [@methane](https://discuss.python.org/u/methane)\
**Post date:** [February 20, 2019, 12:53pm UTC](https://discuss.python.org/t/adding-char-based-apis-for-unix/916/8 "2019-02-20T12:53:58Z")

</div>

> [@malemburg](#):
>
> wchar\_t has been around long enough for people to feel comfortable with it.

I don’t think so. `wchar_t` is designed before UTF-8 era.  
Using `wchar_t` in right way on Unix is hard. It is based on locale. `mbstowcs` may be buggy on some systems.  
I don’t want to learn about `wchar_t`. I don’t want to force young people to learn about `wchar_t` too.

For example, vim uses `Py_SetPythonHome`. See this code.

> <https://github.com/vim/vim/blob/14816ad6e58336773443f5ee2e4aa9e384af65d2/src/if_python3.c#L874-L887>

Strictly speaking, vim should use `Py_DecodeLocale` instead of `mbstowcs` here, if I understand the API correctly. But I’m not sure.  
This is one example of how embedding Python correctly on Unix is difficult.

path is bytes in Unix. So `char*` based APIs is simple and easy to configure paths.

---

_[View the full topic](https://discuss.python.org/t/adding-char-based-apis-for-unix/916)._
