libtconv-0.1 manual
tconv::set_oenc
void tconv::set_oenc(const char *oEncP = NULL);
declared in tconv.h, include tconv.h

oEncP location of valid C locale, optional, defaults to NULL.

Function takes new output character set encoding to be used in future tasks. It does not validate whether it is valid for given operating system or not. It can be used in cases when converting between many different character formats, with use of a single tconv instance or when the tconv instance was created without initial encoding provided. The string for oEncP must be a valid C locale (LC_CTYPE) for the operating system, where this library is about to be used.

There is no value returned.

Example
// C++ source

#include <new>
#include "tconv.h"

using namespace std;

int main(){
  tconv *tcP;

  tcP = new (nothrow) tconv();
  // no encoding provided

  // ...

  if(tcP){
    tcP->set_oenc("en_GB.iso_8859-1");
    // use ISO-8859-1 for output jobs
  }

  // ...

  if(tcP) delete tcP;

  return 0;
}

NOTE: Locales shown in the example are POSIX/Linux specific. For MS Windows the locales might look like "English_England.ACP", which represents "windows-1252", "Polish_Poland.OCP", that stands for oem code page "oem-852" or finally "UTF8" for much broader range of characters.

Copyright 2015 TinyIT All rights reserved
Last modified 2015-06-04