I have to use a method that sends a zero terminated string:
ssize_t send_utf8 (char *buffer)
Where buffer is a string coded as "utf-8" or "ISO-8859-1". This function sends a zero terminated string using another function that sends a buffer (this function is transparent and the buffer may be binary data):
ssize_t send (void *buffer, size_t num)
Where buffer is the buffer to be send and num is the number of bytes.
I've implemented this way, but before calling the send() method I have to convert the buffer coded as UTF-8.
ssize_t send_utf8 (char *buffer) {
// UTF-8 conversion?
net_http_send(buffer, strlen(buffer));
return connection->content_len; // number of bytes written
}
Should I use any library or is there a quick way to convert this buffer? Thanks in advance.