From 38a36fd7ea4a4d9bd4f8ea659f846b7d8784e27b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 24 Feb 2014 21:07:15 +0100 Subject: client API: add comment about character encoding issues Also mention that NULL isn't valid. Although I'm not sure whether the implementation strictly follows this (it should, but there are some wacky corner cases). --- libmpv/client.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libmpv') diff --git a/libmpv/client.h b/libmpv/client.h index d94c129c74..462ff3a9bd 100644 --- a/libmpv/client.h +++ b/libmpv/client.h @@ -364,6 +364,14 @@ typedef enum mpv_format { * The basic type is char*. It returns the raw property string, like * using ${=property} in input.conf (see input.rst). * + * NULL isn't an allowed value. + * + * Warning: although the encoding is usually UTF-8, this is not always the + * case. File tags often store strings in some legacy codepage, + * and even filenames don't necessarily have to be in UTF-8 (at + * least on Linux). If you pass the strings to code that requires + * valid UTF-8, you have to sanitize it in some way. + * * Example for reading: * * char *result = NULL; @@ -665,6 +673,8 @@ int mpv_get_property(mpv_handle *ctx, const char *name, mpv_format format, * Return the value of the property with the given name as string. This is * equivalent to mpv_get_property() with MPV_FORMAT_STRING. * + * See MPV_FORMAT_STRING for character encoding issues. + * * On error, NULL is returned. Use mpv_get_property() if you want fine-grained * error reporting. * -- cgit v1.2.3