> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/iconv/__iconv_get_list.3.md).

# \_\_iconv\_get\_list.3

`__iconv_get_list` — 获取 [iconv(3)](/man/iconv/iconv.3.md) 所支持的字符编码列表

## 名称

`__iconv_get_list`, `__iconv_free_list`

## 库

Lb libc

## 概要

`#include <iconv.h>`

`Ft int Fn __iconv_get_list char ***names size_t count bool paired Ft void Fn __iconv_free_list char **names size_t count`

## 描述

`__iconv_get_list` 函数获取 [iconv(3)](/man/iconv/iconv.3.md) 调用所支持的字符编码列表。编码名称列表将存储在 `names` 中，条目数量存储在 `count` 中。若 `paired` 变量为真，列表将按规范名称/别名配对排列。

`__iconv_free_list` 函数用于释放调用 `__iconv_get_list` 时分配的内存。

## 返回值

成功完成时，`__iconv_get_list` 返回 0 并设置 `names` 和 `count` 参数。否则，返回 -1 并设置 errno 以指示错误。

## 参见

[iconv(3)](/man/iconv/iconv.3.md), [iconvlist(3)](/man/iconv/iconvlist.3.md)

## 标准

`__iconv_get_list` 和 `__iconv_free_list` 函数是非标准接口，最早出现于 Citrus 项目的实现。Citrus 项目的 iconv 实现在 FreeBSD 9.0 中引入。

## 作者

本手册页由 Gabor Kovesdan <gabor@FreeBSD.org> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/iconv/__iconv_get_list.3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
