Thanks for the reply. create_unicode buffer returns just a wchar array. It’s a ctypes functon. I don’t know much about the encoding method of it. All I have is a pointer to wchar array. It is possible to know the length too. In any other langs, I can use pointer indexing to get the data.
Ah, sorry, I thought this was something from elsewhere! My bad.
(It would be very helpful to include your imports so that we know which parts of your code come from the standard library and which aren’t. I still have no idea what SendNotifyMessage is, so I’m assuming that that’s something custom.)
So, having checked the docs for create_unicode_buffer… this gives back an array. And you’re getting a pointer to that. We then have to assume that SendNotifyMessage carries that across to the receiving end and gives back a pointer. But I’m not 100% sure of what byte encoding is being sent around the place. When I tested it, I was able to get back a valid bytesrting by using c_char_p (not c_wchar_p), but without SendNotifyMessage in the middle, I have no idea how meaningful that is.
It’s worth noting that bytes are the only things that can be sent around, so it might be easier to lean into that and simply send a byte string and decode it on the other side. That way, you’re the one in control of the encoding (and UTF-8 is usually a good choice), which will make life a lot easier.