i call python script from my php,this is a demo
when i pass english params like "abcdxx", it's fine
when i pass chinese params like "天河"(even) the return is "天河"
when i pass chinese params like "天河区"(odd),the return is "天河åŒ?"
my php file
<?php
$param = "天河" //天河区 abc
$keyword = exec("jieba.py " . $param);
var_dump($keyword);
?>
my python file
#coding:utf-8
import sys
print sys.argv[1]
I have fixed the bug.
I don't how to solve this problem, but I used another way.
I urlencode params "天河" in php,then unquote "天河" in python, it's done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With