Detect encoding and make everything UTF-8

前端 未结 24 2980
暗喜
暗喜 2020-11-22 03:03

I\'m reading out lots of texts from various RSS feeds and inserting them into my database.

Of course, there are several different character encodings used in the fee

24条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-22 03:31

    It's simple: when you get something that's not UTF-8, you must encode that into UTF-8.

    So, when you're fetching a certain feed that's ISO 8859-1 parse it through utf8_encode.

    However, if you're fetching an UTF-8 feed, you don't need to do anything.

提交回复
热议问题