opcodesio/log-viewer

it doesn't support arabic language

joukhar opened this issue · 11 comments

  "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\"}",

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

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.

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

@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.

[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 "حدث خطأ ما".

@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).

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

@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.

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

@joukhar awesome, thanks for confirming! 😃 closing