0

I am using Lumen framework to provide API for my main site.

A URI to insert a tag looks like this:

$router->get('/addtag/{id}/{tag}', 'BookController@addTag');

When tag is Chinese, it was inserted into the database encoded:

中文 becomes %E4%B8%AD%E6%96%87.

The database is set to utf8m64/.

Appreciate your input on this.

TaylorR
  • 3,746
  • 5
  • 25
  • 42

1 Answers1

0

I found a solution to this issue:

$results=DB::insert($sql, [$id, htmlspecialchars(urldecode($tag))]);

Looks ugly, but works so far.

TaylorR
  • 3,746
  • 5
  • 25
  • 42