Skip to main content


Last updated March 2020


ec_convert_buffer_to_string — Convert a buffer from one encoding to another


#include "misc/converter.h"

| int **ec_convert_buffer_to_string** ( | fromcode, |   | |   | frombuf, |   | |   | frombuflen, |   | |   | tocode, |   | |   | deststring); |   |

const char * <var class="pdparam">fromcode</var>; const char * <var class="pdparam">frombuf</var>; int <var class="pdparam">frombuflen</var>; const char * <var class="pdparam">tocode</var>; string * <var class="pdparam">deststring</var>;



This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

Convert a buffer from one encoding to another.

This is a convenience wrapper around opening a converter and converting each portion of the source string through it and storing it in the destination string.



the encoding used for the input data


the source of the input data


size of input data


the encoding to be used for the output data


the destination for the converted data

Data is read from the start of the buffer in frombuf.

Return Values

Returns ECCONV_OK on success, or some other value on error.


This function may induce IO or otherwise block the caller. Blocking in the scheduler thread will lead to degraded performance and should be avoided at all costs. If your code is running in the IO subsystem, the core will have already taken steps to ensure that blocking is acceptable. Otherwise, you should look at using the thread pool API to run a job in the IO pool.

**Configuration Change. ** This feature is available starting from Momentum 3.1.

Was this page helpful?