1

Scenario: I created a plugin that scrapes meta data from news sites and stores in my D/B. However these pages could be in English, Russian, Chinese, Spanish and so on. I'm having one heck of a time scraping the data and storing in D/B generically. What is best method to grab the data from these pages, store to MySQL and then render on a single webpage? For example I may have 4 teasers featuring 4 different languages on one page. Not likely but technically it could happen.

Adrianopolis
  • 1,272
  • 1
  • 11
  • 15

1 Answers1

2

You'll want to store the data in your database using the UTF-8 charset. See this question for more information, paying particular attention to the answer describing the utf8mb4 option.

Later, when you retrieve this stored data and display it on a webpage, you should ensure that your HTML charset is set to UTF-8 via the <meta charset="utf-8" /> header tag.

Community
  • 1
  • 1
Nate
  • 1,442
  • 14
  • 22
  • 1
    Thanks, I have not checked into utf8mb4 will do and test it out tonight and make update to stack. – Adrianopolis Feb 01 '17 at 19:07
  • Hey Nate! I just wanted to update. Everything was just fine but just as you mentioned I just needed to swap my cols from utf8_general_ci to utf8mb4_general_ci and it did the trick! Thanks! – Adrianopolis Feb 03 '17 at 04:55
  • Awesome, I'm glad this helped! Cheers :) – Nate Feb 03 '17 at 14:04