[FFmpeg-devel] [RFC] function to check for valid UTF-8 string

Reimar Döffinger Reimar.Doeffinger
Sun Dec 9 15:19:26 CET 2007


Hello,
On Sun, Dec 09, 2007 at 02:40:51PM +0100, Michael Niedermayer wrote:
> On Sun, Dec 09, 2007 at 11:18:32AM +0100, Reimar D?ffinger wrote:
> > since Rich seems to have given up on it, here is a proposed patch
> > that adds a av_check_utf8 function that could be used to validate
> > input strings.
> > Since it hacked it up very quickly please forgive any bugs or other
> > stupidity.
> 
> maybe the function should return a index to the last valid or first
> invalid byte or something like that?

Don't know. But I can easily change the "return 0;" to "return last;" and
"return 1;" to "return NULL;", so it would point to the start of the
first invalid unicode character, which would allow for easy truncating
of invalid strings, though I don't consider that too useful.

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list