Home>
I am a beginner using laravel
I'm trying to return the data stored in DB with json
When it outputs, it is garbled.
I want to avoid garbled characters
User information is stored in DB
It is not garbled on DB, but if you output with json_encode ()
"id": 1, "user_id": 1, "name": "\ u3055 \ u304f \ u3089 \ u306f \ u306a \ u3048", "sex": 2, "age": 36, " work ":" \ u516c \ u52d9 \ u54e1 "......
Will be garbled. (Name and work include "Tanaka Tarou" and "Public employee" in Japanese on the DB)
public function show (Profile $profile)
{
$profilejson = json_encode ($profile);
return view ('profiles.show', compact ('profile', 'profilejson'));
}
{{$profilejson}}
If i output as garbled characters will appear.
Supplemental information (FW/tool version etc.)
laravel5.6, using resource controller.
-
Answer # 1
Related articles
- c# - the output json-like character string cannot be handled as json
- ruby - the value of the csv file output from the rails application drops by 0, or the character string becomes a numerical value
- how to output the character string read from the csv file to pdf
- php - output of specified character in character string
- please tell me how to output the character string
- 3b the character string read from the file cannot be output in reverse order
- python - i want to output an additional character string after leaving the past text
- output the day of the week character string with java
- python 3x - i want to output a character string that contains a specific character string
- validate the character string received by java scanner one by one, and prompt for re-entry if invalid character is included
- regular expressions - i want to divide the character string into two parts at the specified part
- google apps script - find the character string (a) in the a column of the spreadsheet with gas and enter the character string (b
- i want to enter a character string that includes a line break
- measure the length of the character string using the pointer (second time)
- linux - is there a way to refer back to a character string that matched a wildcard in bash, etc?
- [excel] multiple conditions "blank if blank or character string xx, blank otherwise, formula (example: total value)"
- i want to replace the string that is output to standard output with c ++ later
- i want to find the length of a character string using a pointer
- JDK9's new features: String compression and character encoding implementation method
- vba - i want to extract the middle part of the character string
Related questions
- php - about the multiple structure of laravel's many-to-many relations
- i want to laravel post and register it in the database
- php - laravel relation cannot be defined
- php - regarding when extracting laravel relation defined data
- mysql - "database seeding completed successfully" is displayed using seeder, but it is not inserted in the db
- python - i want to import a text file (jsonl) to the database at once
- postgresql - i don't know the initial password for postgressql
- php - laravel can't access local mysql
- how do i get the average when inserting data into a table?
- reflection of table definition in mysql by laravel migration does not work well
Specification of json_encode.
As long as you pass it to javascript as it is, you can use it as it is
(Returns properly when decoding)
I really want to display Japanese
will display Unicode without encoding