我有一個數據編碼問題。我的數據庫在其中一列中有口音,在api中返回一個PDO查詢SQL SERVER中的列。只要我返回,我通過json_encode方法轉換成JSON,再加上JSON就是NULL。當我給var_dump帶有重音符號的問號時,這個字符會出現' ',而json是空的。 我知道這是我需要轉換爲UTF8的編碼,但我無法在php中進行此轉換。誰能幫我?返回JSON NULL
0
A
回答
-2
相關問題
- 1. ajax JSON返回null
- 2. 返回null的JSON
- 3. Json :: decode返回NULL
- 4. JSON結果返回null
- 5. php JSON對象返回null
- 6. GSON JSON解析返回null
- 7. 的Json解碼返回NULL
- 8. JSON PHP數據返回null
- 9. Json數組返回null
- 10. 爲什麼WCF/JSON不爲null返回值返回`null`?
- 11. null == null返回false?
- 12. JSON解析與GSON返回null
- 13. 解析JSON字符串返回null
- 14. JSON返回null jQuery $ .ajax後類型
- 15. JSON解析與GSON返回null對象
- 16. Spring Boot Rest API JSON返回null
- 17. 發送json數據到php返回null
- 18. Datatables - Json輸出 - PostgreSQL - 返回null
- 19. C#的Android列出返回NULL - JSON API
- 20. codeigniter從JSON控制器url返回null
- 21. PostgreSQL的JSON類型返回null
- 22. JSON返回null響應與jQuery $ .ajax
- 23. Android JSON請求,輸入流返回null
- 24. PropertyInfo.GetValue(null,null)返回null
- 25. 從MSQL數據庫返回數據的JSON總是返回NULL
- 26. UISwitch返回NULL?
- 27. getElementById返回null
- 28. ListView.getTag()返回null
- 29. LocationManager返回null
- 30. BitmapFactory.decodeFile()返回null
幫助嗎? http://stackoverflow.com/questions/16800915/php-pdo-charset-utf8-an-invalid-keyword-charset-was-specified-in-the-dsn-str –
嘗試'utf_encode()'並檢查。你能否也請告訴那裏的原始人物是什麼? –
<?php ini_set('display_errors',1); ini_set('display_startup_errors',1); include_once'../../../config.php'; include_once'../../../config.php'; include_once'../api/helpdesk.php'; include_once'../api/conexaoSql.php'; require_login(); $ codigo = $ _GET ['id']; 嘗試{ $ objHelp = new helpdesk(); $ mensagens = $ objHelp-> SelecionaMensagem($ codigo); // var_dump($ mensagens); echo json_encode($ mensagens,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); ($ e-> getMessage());}};}};}}; } –