Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Avoid special chars (now i need help)


This topic is 7855 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 : &#235

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.