]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip: Replace invalid UTF-8 sequences in callerid name
authorGeorge Joseph <gjoseph@sangoma.com>
Thu, 16 Feb 2023 16:05:30 +0000 (09:05 -0700)
committerJoshua Colp <jcolp@sangoma.com>
Thu, 2 Mar 2023 14:21:37 +0000 (08:21 -0600)
commit1ddfb7551a42fce6165726b0d5834668c3fdbcf6
tree39e8ee6878937b8f81b449299ee497d46b01749b
parenta724298da99259373ef2be383b035a8a35800baf
res_pjsip: Replace invalid UTF-8 sequences in callerid name

* Added a new function ast_utf8_replace_invalid_chars() to
  utf8.c that copies a string replacing any invalid UTF-8
  sequences with the Unicode specified U+FFFD replacement
  character.  For example:  "abc\xffdef" becomes "abc\uFFFDdef".
  Any UTF-8 compliant implementation will show that character
  as a � character.

* Updated res_pjsip:set_id_from_hdr() to use
  ast_utf8_replace_invalid_chars and print a warning if any
  invalid sequences were found during the copy.

* Updated stasis_channels:ast_channel_publish_varset to use
  ast_utf8_replace_invalid_chars and print a warning if any
  invalid sequences were found during the copy.

ASTERISK-27830

Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8
include/asterisk/utf8.h
main/stasis_channels.c
main/utf8.c
res/res_pjsip.c