etherpad-lite icon indicating copy to clipboard operation
etherpad-lite copied to clipboard

Retrieving german characters from Etherpad

Open kernelfreak opened this issue 10 years ago • 6 comments

Hello friends,

I am trying to save and retrieve german characters from Etherpad and it's not working well. Lets say I have a text "löschen". When I try to save it, its getting saved, but when retrieving it, I get weird characters back. When I try to retrieve it, I get back "lC6schen". In settings.json, I have changed the language to de, but that also has not helped. I tried getting html instead of text, then instead of löschen, I get back the HTML operand for 'ö', not very helpful. Why is that etherpad saves something in one way and doesn't translate it back while returning. How can I do it. I have also tried saving first an empty text, getting the pad-id, adding doc-type, and html, body tags, and saveHTML, but return method still gives me messed up characters.

Below is the way, I am saving and retrieving pads.

public String createPadObjectsForNewNotes(String sessionData, String text){ sessionData=sessionData.replace(""",""); sessionData = sessionData.substring(1, sessionData.length() - 1); String[] keyValuePairs = sessionData.split(","); Map map = new HashMap<>(); String str = new BigInteger(130, random).toString(32); for(String pair : keyValuePairs) { String[] entry = pair.split(":"); map.put(entry[0].trim(), entry[1].trim()); } Map pad = client.createGroupPad(String.valueOf(map.get("groupID")), str, text); if(pad!=null){ return String.valueOf(pad.get("padID")); } return null; }

2nd method to retrieve :

`

public String getTextForGivePad(String padId){ if(client!=null){ Map padObj = client.getHTML(padId); if(padObj!=null){ return padObj.get("html").toString(); } } return null; }`

How can I solve this problem. Thank you.

kernelfreak avatar Nov 09 '16 11:11 kernelfreak

If you open the pad on your browser, do you see the correct char on the editor?

lpagliari avatar Nov 10 '16 08:11 lpagliari

@lpagliari : No, In CSS preview of the object, I see it correctly as it's retrieved from PostgreSQL DB, but not in Etherpad, that's the actual problem we are facing. Thank you.

kernelfreak avatar Nov 10 '16 10:11 kernelfreak

@kernelfreak Is this text correctly stored in your postgresql database?

Gared avatar Dec 19 '16 23:12 Gared

@Gared Our DB is encrypted, so I cannot be sure.

kernelfreak avatar Dec 22 '16 09:12 kernelfreak

@kernelfreak I'm not familiar with postgresql, but maybe is has something to do with the encoding of your db. What encoding did you configure? Can you set the log level to "DEBUG" and have a look how your umlauts are being displayed on the CLI/log?

Gared avatar Dec 22 '16 23:12 Gared

Character encoding was wrong on DB.

JohnMcLear avatar Apr 03 '18 16:04 JohnMcLear