good afternoon , have script in python run php. script makes query database , returns json object :
[{"esc_def": 0, "esc_eje": 2017, "esc_fec_pre": null, "esc_usu_baja": null, "esc_nom": "prueba fran 3", "esc_sit": "abierto", "esc_usu_alta": "hep68", "ronda_id": 1, "esc_ori": "gestión económica", "esc_sit2": "borrador", "esc_fec_frcg": null, "esc_tpo": "presupuesto", "esc_org": "1214", "esc_fec_alta": "19/07/2016 10:39:20", "esc_fec_fir": null, "cre": 0.00, "id_ptoege": null, "esc_fec_baja": null, "esc_cod_baja": null, "id": 3637, "est_org_nom": null}]
the command use :
son_output = json.dumps((my_query), default=custom_json, ensure_ascii=false)`
in php run , pick result follows :
exec('python3 sqlserver.py'. " ".$parametro, $output, $ret_code); $json = implode($output); echo utf8_encode(stripslashes($json));
but content displayed follows :
"esc_ori": "gestixc3xb3n econxc3xb3mica"
accented characters not displayed correctly .
sorry if did not express myself in english .
"\xc3\xb3" "ó". in removing slashes stripslashes($str) you're losing unicode escapes , therefore getting weird chars instead of small latin o you're looking for. not versed in php try running without function.
Comments
Post a Comment