PostgreSQL - Replace HTML Entities

前端 未结 3 1036
闹比i
闹比i 2020-12-11 20:36

I have just set about the task of stripping out HTML entities from our database, as we do a lot of crawling and some of the crawlers didn\'t do this at input time :(

3条回答
  •  天命终不由人
    2020-12-11 21:04

    You could use xpath (HTML-encoded content is the same as XML encoded content):

    select 
      'AT&T' as input ,
      (xpath('/z/text()', ('' || 'AT&T' || '')::xml))[1] as output 
    

提交回复
热议问题