opcodesio / log-viewer

Fast and beautiful Log Viewer for Laravel
https://log-viewer.opcodes.io
MIT License
3.39k stars 237 forks source link

it doesn't support arabic language #345

Closed joukhar closed 4 months ago

joukhar commented 4 months ago

  "RESPONSE": "{\"success\":false,\"message\":\"\\u0643\\u0644\\u0645\\u0629 \\u0627\\u0644\\u0645\\u0631\\u0648\\u0631 \\u0627\\u0644\\u0642\\u062f\\u064a\\u0645\\u0629 \\u0644\\u0627 \\u062a\\u062a\\u0637\\u0627\\u0628\\u0642 \\u0645\\u0639 \\u0643\\u0644\\u0645\\u0629 \\u0627\\u0644\\u0645\\u0631\\u0648\\u0631 \\u0627\\u0644\\u062e\\u0627\\u0635\\u0629 \\u0628\\u0643\"}",
arukompas commented 4 months ago

hey @joukhar , please share the log file, and a screenshot of how it appears in Log Viewer.

joukhar commented 4 months ago

@arukompas Screenshot from 2024-03-04 10-01-55

arukompas commented 4 months ago

hey @joukhar , thanks for the screenshot. How about the log file itself? It could be that the content is stored in the log file like this, therefore there's nothing for the Log Viewer to do and it just displays the content inside the api-requests.log file.

joukhar commented 4 months ago

nah , it returns translated string from /lang/ar.json , and i used dd()

arukompas commented 4 months ago

@joukhar could you share the contents of the storage/logs/api-requests.log file?

So that I can reproduce it and see how I can fix it. I don't have any example files with arabic characters.

joukhar commented 4 months ago
[2024-03-06 18:06:32] production.ERROR: Api Request {"URL":"PRIVATE","METHOD":"POST","USER_AGENT":"PRIVATE","IP":"PRIVATE","USER":"PRIVATE","REQUEST_BODY":{"id":"PRIVATE","answers":"PRIVATE","totalTime":44},"RESPONSE":"{\"success\":false,\"message\":\"\\u062d\\u062f\\u062b \\u062e\\u0637\\u0623 \\u0645\\u0627\"}","LOCALE":"ar"} 

i use ai for this because im lazy to come with solution, it easy but u just need to convert readable text.

The Arabic text for "\u062d\u062f\u062b \u062e\u0637\u0623 \u0645\u0627" is "حدث خطأ ما".

arukompas commented 4 months ago

@joukhar ok, but that's what I mean. The log message is logged as characters \u062d\u062f\u062b \u062e\u0637\u0623 \u0645\u0627 inside the api-requests.log file, not as arabic unicode characters.

Log Viewer just displays whatever's inside the file and it should not do any kind of hex-to-unicode conversion because that would be misleading to what is actually logged in the file.

The issue is somewhere else, because it's not saving arabic characters into the log file itself. Perhaps the API itself is returning non-arabic characters (\u062d\u062f\u062b \u062e\u0637\u0623 \u0645\u0627).

joukhar commented 4 months ago

you have a point there maybe json requests are the cause , i will try making a web and api request to the server with custom request logger middleware and i will reply with the result

arukompas commented 4 months ago

@joukhar the easiest way is to just open your api-requests.log file inside a text editor. If it does not contain arabic characters inside a simple text editor, then Log Viewer won't display them either. That's why I asked to share the log file itself, because all of this depends on whether the actual arabic characters exist inside the text file.

joukhar commented 4 months ago

You're right i tested it on vscode and it doesn't show proper arabic , the problem is in json requests

arukompas commented 4 months ago

@joukhar awesome, thanks for confirming! 😃 closing