Rahim, the solution bellow is only for 4GL code , do not apply to Informix SQL Statement. Easily this can be rewrite to Informix Stored Procedure (but I know as SP this will not solve your problem) :
MAIN
DEFINE p_sql varCHAR(200)
DEFINE p_dest varCHAR(200)
DEFINE i,x,z INTEGER
LET p_sql = arg_val(1)
LET x=1
LET p_dest=''
FOR i = 1 TO length(p_sql)
IF p_sql[i,i] = '"' THEN
LET p_dest=p_dest,p_sql[x,i],'"'
LET x=i+1
END IF
END FOR
LET i=length(p_sql)
IF x < i THEN
LET p_dest=p_dest,p_sql[x,i]
END IF
DISPLAY p_sql
DISPLAY p_dest
END MAIN
The test result:
$ fglgo x "test 'one' "
test 'one'
test 'one'
$ fglgo x 'test "one" '
test "one"
test ""one""
$ fglgo x 'test "one"'
test "one"
test ""one""
$ fglgo x 'test "one" x'
test "one" x
test ""one"" x