Solved Html entities in the database.
-
Hi,
When an agent enters greek text in the html editor in the ticket message field, the text is saved as html entities in the db (& Omicron;& Nu;& Omicron;& Mu;& Alpha; etc...).
This causes a problem when we want to export the data directly from the mysql. Is there a workaround for this?
Can we maybe completely disable the html editor and enter only plain text in every field?Thank you & a Happy New Year!
-
@peopleinside
Hi and thank you both for the time you spend on my problem.
I managed to find a solution by editing the initialization of tinyMCE in ticket.html.twig & savedReplyForm.html.twig
I added the linessfTinyMce.init({ ... entity_encoding: "raw", forced_root_block : "", ...
and now the greek text is saved as readable text in the db.
Cheers!
-
@theochvas thank you for your question!
A developer will reply as soon as possible, if not feel free to write back here.Happy Holidays and Happy New Year!
-
@theochvas said in Html entities in the database.:
e completely disable the html editor and enter only plain text in every field?
Actually editor always saves data as same as you write on it (like spacing, colors, bold text etc) so that we always make it save as same on database.
But when we fetch it from our database then we just parse HTML and show the same on front end without any html tag.
So if you will export Database you will simply receive all HTMl with content.
-
So if you will export Database you will simply receive all HTMl with content.
Yes, that would be ok with english text, but greek text is unreadable when inside html in the database because it's saved as html entities: Ļνομα -> '& Omicron;& Nu;& Omicron;& Mu;& Alpha;' .
And so the export is also unreadable.
Can i disable the html editor in the ticket message field and enter plain text instead?
Thank you. -
Locate path:
vendor/uvdesk/core-framework/views/ticket.html.twigOpen ticket.html.twig and remove line from here.
-
Now, i get an error when i try to edit a message or add an answer
Uncaught ReferenceError: tinyMCE is not defined
-
@theochvas please try to clear cache, you can do in dashboard main page at right bottom (dark trash icon) or by SSH with command: php bin/console c:c
-
@peopleinside said in Html entities in the database.:
php bin/console c:c
I tried clearing the cache both ways, but i still get when the ticket page loads:
Uncaught ReferenceError: sfTinyMce is not defined
at 409:4210Uncaught TypeError: sfTinyMceNew2.init is not a function
at InitTinyMce (409:4230)
at r.initialize (409:3103)
at r.e.View (backbone.js:1300)
at new r (backbone.js:2060)
at HTMLDocument.<anonymous> (409:4180)
at e (jquery.min.js:2)
at t (jquery.min.js:2)and when i try to edit a ticket message
Uncaught ReferenceError: tinyMCE is not defined
at r.fn (409:2826)
at Object.fn (backbone-validation-min.js:8)
at nr (underscore-min.js:6)
at Object.<anonymous> (underscore-min.js:6)
at Object.fn (underscore-min.js:6)
at backbone-validation-min.js:8
at r (underscore-min.js:6)
at Function.<anonymous> (underscore-min.js:6)
at i (backbone-validation-min.js:8)
at r.<anonymous> (backbone-validation-min.js:8) -
@theochvas said in Html entities in the database.:
Uncaught ReferenceError: sfTinyMce is not defined
at 409:4210As tinymce is used here with many function so it will create an issue. you can check all file and instead of getting value through tinymce use simple testarea value.
-
@theochvas what steps do you follow for see an error in UI?
When you say edit ticket what steps you follow to edit a ticket?
I tried to edit a ticket as admin but i get no error.You cannot edit ticket messages in a ticket, you can maybe only edit the initial ticket created, right?
Also what version of database are you using?
I discovered with another open source app that when I migrated from Mysql 5.7 to MAriaDB I resolved issues on importing a backup of that opensource... before I had always an issue on exportation so maybe are you sure the issue is not maybe ... the database app used? -
peopleinside
-
@peopleinside I click on 'Edit Ticket', the modal appears, but the Update button does nothing & i get the error in the browser console.
Same for leaving a reply: The 'Reply' button does nothing & i get the error.The db is MySQL 8.0.24
-
@theochvas I am unable to reproduce on the latest version and with the edit suggested in the previous developer reply.
Can you try to reproduce in a new test instance of UVdesk?
-
@theochvas The error is resolved if you revert back edits suggested from the developer?
Maybe you are having issue for a not fully correct resume of your existing install? Is restored from a database import? -
The error is resolved if you revert back edits suggested from the developer?
Yes.
Maybe you are having issue for a not fully correct resume of your existing install? Is restored from a database import?
Sorry, i'm not sure what you mean here. The installation is 1.0.18 done through the web installation wizard.
-
@theochvas I understand why I was not able to reproduce: I replaced the file with the suggested file instead of delete the suggested line.
In your initial message you said:
When an agent enters greek text in the html editor in the ticket message field, the text is saved as html entities in the db (& Omicron;& Nu;& Omicron;& Mu;& Alpha; etc...).
This causes a problem when we want to export the data directly from the mysql.You are having an issue in the database export if in the ticket there is a Greek text?
Greek is the language? The issue you are facing is only with that language I suppose?Once the database exported if you import again you are so unable to restore correctly the ticket system? This question to understand if you are reporting an issue on exporting database so in backup correctly UVdesk for a future resume.
Why you export the database, for backup purpose?
-
@peopleinside Yes, the problem is with greek text when entered in the html-editor.
I have not tried to import the backup to the db,
The export made is for reporting and backup of the tickets.The 'message' field in the 'Create New Ticket' modal is plain text instead of tinyMCE, can i maybe alter the 'message' field code in the 'Edit Ticket' & 'Reply to ticket' Forms to also not load the tinyMCE editor?
Thank you for your time.
-
@theochvas with greek text you mean Greek language?
Sorry if I ask but English is not my primary language and I may have some difficulty in understanding . I suppose is the Grek language, i don't know that language as I use Italian and English.
I have not tried to import the backup to the db,
The export made is for reporting and backup of the tickets.Umh if the scope is the backup I suggest to simply made a try to backup than resume, maybe in a duplicate instance of test, the backup. If the backup is resumed correctly, ticket are showed correctly I think you should not worry how the database is exported.
The 'message' field in the 'Create New Ticket' modal is plain text instead of tinyMCE
n a last update of UVdesk a text editor has been added in visitor side but also on operator side. This has been done because with the normal text field the formatting of text was not respected in email and ticket as well. See this issue: https://github.com/uvdesk/community-skeleton/issues/510 so introducing a text editor is an improvement.
Maybe you still have a version that has not yet last GitHub edits but you may have on next update.. so if you have not a text editor on operator ticket creation, a future update will add it.
can i maybe alter the 'message' field code in the 'Edit Ticket' & 'Reply to ticket' Forms to also not load the tinyMCE editor?
I don't know, I'm not a programmer but only an passionate UVdesk user that try to help in free time.
I suggest to understand if you have a real problem or if your requests is a customization that can be maybe possible with the free Open Source and the free support.
If you found a real issue for all, for example if you see that is not possible restore correctly tickets from a backup.. in this case I think the UVdesk staff can and should look into this because maybe all users that will have UVdesk with Greek language text can have the same issue. Be able to backup and resume is essential.Have an exported database well readable is less important... database is a storage file that should be work for resume a backup that should resume all in UI without errors.
This is my point of view. -
Editor will always save the same text you write it over along with all your space and other changes you have done to make a proper format.
So whenever you will take it from db you will get all data save in db normally we parse html data and only show the data.
If there is any issue specifically for your language then you can raise an issue on github with all steps and words you are using.
-
@peopleinside
Hi and thank you both for the time you spend on my problem.
I managed to find a solution by editing the initialization of tinyMCE in ticket.html.twig & savedReplyForm.html.twig
I added the linessfTinyMce.init({ ... entity_encoding: "raw", forced_root_block : "", ...
and now the greek text is saved as readable text in the db.
Cheers!
-
Glad to know it resolved your issue.