Skip to main content

ec_convert_buffer_to_string

Last updated March 2020

Name

ec_convert_buffer_to_string — Convert a buffer from one encoding to another

Synopsis

#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>;

Description

Note

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.

Parameters

fromcode

the encoding used for the input data

frombuf

the source of the input data

frombuflen

size of input data

tocode

the encoding to be used for the output data

deststring

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.

Note

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?