---
name: "thwchar.h"
section: "3"
platform: "linux"
package: "libthai-dev"
version: "0.1.6-1+etch1"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/thwchar.h"
---

# thwchar.h(3)

## NAME

thai/thwchar.h -

## Detailed Description

Wide char support for Thai.

## SYNOPSIS

### Defines

\#define **THWCHAR\_ERR**   (~(**thwchar\_t**)0)\
 *Wide-character value indicating error.*

### Typedefs

typedef wchar\_t **thwchar\_t**\
 *Thai character type for storing Unicode character.*

### Functions

**thwchar\_t** **th\_tis2uni** (**thchar\_t** c)\
 *Convert character code from TIS-620 to Unicode.*  int **th\_tis2uni\_line** (const **thchar\_t** \*s, **thwchar\_t** \*result, size\_t n)\
 *Convert string from TIS-620 to Unicode.*  **thwchar\_t** **th\_winthai2uni** (**thchar\_t** c)\
 *Convert character code from Thai Windows extended code to Unicode.*  **thwchar\_t** **th\_macthai2uni** (**thchar\_t** c)\
 *Convert character code from Mac Thai extended code to Unicode.*  **thchar\_t** **th\_uni2tis** (**thwchar\_t** c)\
 *Convert character code from Unicode to TIS-620.*  int **th\_uni2tis\_line** (const **thwchar\_t** \*s, **thchar\_t** \*result, size\_t n)\
 *Convert string from Unicode to TIS-620.*  **thchar\_t** **th\_uni2winthai** (**thwchar\_t** c)\
 *Convert character code from Unicode to Thai Windows extended code.*  **thchar\_t** **th\_uni2macthai** (**thwchar\_t** c)\
 *Convert character code from Unicode to Mac Thai extended code.*

## Function Documentation

### thwchar\_t th\_macthai2uni (thchar\_t c)

Convert character code from Mac Thai extended code to Unicode.

**Parameters:**

*c* : Mac Thai character/glyph to convert

**Returns:**

Corresponding Unicode code

### thwchar\_t th\_tis2uni (thchar\_t c)

Convert character code from TIS-620 to Unicode.

**Parameters:**

*c* : TIS-620 character to convert

**Returns:**

Corresponding Unicode code

### int th\_tis2uni\_line (const thchar\_t \* s, thwchar\_t \* result, size\_t n)

Convert string from TIS-620 to Unicode.

**Parameters:**

*s* : source TIS-620 string (null-terminated) \
 *result* : buffer for storing resulting Unicode string \
 *n* : size of *result* buffer (as number of elements)

**Returns:**

the length of the output Unicode string

### thchar\_t th\_uni2macthai (thwchar\_t c)

Convert character code from Unicode to Mac Thai extended code.

**Parameters:**

*c* : Unicode code to convert

**Returns:**

Corresponding Mac Thai extended code, or `TH_ERR` if conversion is impossible

### thchar\_t th\_uni2tis (thwchar\_t c)

Convert character code from Unicode to TIS-620.

**Parameters:**

*c* : Unicode character to convert

**Returns:**

Corresponding TIS-620 code, or `TH_ERR` if conversion is impossible

### int th\_uni2tis\_line (const thwchar\_t \* s, thchar\_t \* result, size\_t n)

Convert string from Unicode to TIS-620.

**Parameters:**

*s* : source Unicode string (null-terminated) \
 *result* : buffer for storing resulting TIS-620 string \
 *n* : size of *result* buffer (as number of elements)

**Returns:**

the length of the output TIS-620 string

Note that, since the conversion is lossy, some characters in the convesion result may be `TH_ERR`, indicating conversion error.

### thchar\_t th\_uni2winthai (thwchar\_t c)

Convert character code from Unicode to Thai Windows extended code.

**Parameters:**

*c* : Unicode code to convert

**Returns:**

Corresponding Thai Windows extended code, or `TH_ERR` if conversion is impossible

### thwchar\_t th\_winthai2uni (thchar\_t c)

Convert character code from Thai Windows extended code to Unicode.

**Parameters:**

*c* : Thai Windows character/glyph to convert

**Returns:**

Corresponding Unicode code

## Author

Generated automatically by Doxygen for libthai from the source code.
