JitseSchaafsma Posted April 2, 2003 Share Posted April 2, 2003 So i thougth i solved my problem, guess i did not. This is the situation. One of my fields in a database contains special characters, circumflex, grave accent, etc). I read this variables: var1="[FMP-Field: textfield,Break]" When i display var1 in my browser : window.document.myform1.tekstveld1.value=var1 the text is scrambled. for example i see codes like this : ë I have been playing with the field encoding and with escape/unescape function. How should i proceed now? For example i can change all the special characters in the filemaker field with their code, but what code? Any help is welcome Jitse Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 2, 2003 Share Posted April 2, 2003 Have you tried the various ways of showing a field: var1="[FMP-Field: textfield,raw]" var1="[FMP-Field: textfield,format]" Good Luck. Garry Link to comment Share on other sites More sharing options...
JitseSchaafsma Posted April 3, 2003 Author Share Posted April 3, 2003 Thanks gary, indeed i tried that combination. Now i have made my own javascript encode function. This is a sample that only changes the dieresus (umlaut mark). Offcourse this code can be used for all ASCII characters. Jitse function encodestrings(encodestr){ var locstr locstr=encodestr while(locstr.search("ë")!=-1){ locstr=locstr.replace("ë",String.fromCharCode(235)) } return locstr } Link to comment Share on other sites More sharing options...
JitseSchaafsma Posted April 3, 2003 Author Share Posted April 3, 2003 Now this is the complete function (that i think does the job) function encodestrings(encodestr){ var locstr var codestr var code var i =0 var k =0 locstr=encodestr while (i !=-1) { i = encodestr.indexOf("&#",i) k = encodestr.indexOf(";",i) if (i!=-1){ codestr=encodestr.substr(i+2,k-i-2) encodestr=encodestr.replace("&#"+codestr+";",String.fromCharCode(codestr)) i=i+1 } } while(encodestr.search("<br>")!=-1){ encodestr=encodestr.replace("<br>","n") } return encodestr } Jitse Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 4, 2003 Share Posted April 4, 2003 Have you tried something like this: document.write(unescape("[FMP-Field:textfield]"); Good Luck. Garry Link to comment Share on other sites More sharing options...
JitseSchaafsma Posted April 7, 2003 Author Share Posted April 7, 2003 Thanks Gary, Indeed i have tried unescape, to no avail. until now the javascript works good. Greetings Jitse Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7855 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now