Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Dynamic Ajax Content Chars being replaced

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I wasn't going to say anything, in case it worked but - I didn't think it would. I figured that the £ character had already been stripped of its hex value by the process that created the variable 'page_request.responseText'. I also didn't say anything because I am not sure how to make the desired substitution before that process mangles the £ character. I'll have a look around to see if it might be possible though.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, since the responseText appears to be an intrinsic property of the page_request object, there really isn't any room for intervention there. You could use £ on the page to begin with, or there may be a way to configure the server to pass this character in the page_request object without stripping its high bit. I think mwinter had posted something about either doing this or about its not being possible. I will see if I can find that post.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #13
    Join Date
    Jul 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks John,

    Now using an alternative, but will keep comming back to see if there is a solution

  4. #14
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, I looked for a post with that information yesterday but couldn't come up with effective search terms. Just now I hit upon the correct combination and found this post:

    http://www.dynamicdrive.com/forums/s...ead.php?t=3644

    In it, mwinter (our 'semiretired' grandmaster problem solver) explains two methods to ensure that the host serves the document with the desired character encoding. Unfortunately, one of them - the .htaccess file method - may only work on an Apache server.

    This was in response to a slightly different question so, a third solution was also offered - the meta tag solution. This we have already determined will not work in this case.

    So, I would recommend that you try one or the other of the other two solutions. Either of these will actually configure the server to use that encoding, at least for your site. This is different from meta tag encoding which simply tells the user agent (browser) to use the desired encoding.

    Now, I am not certain this will be a solution but, I think it might be and I'm fairly certain that if it is not, that there is probably no solution other than the £ entity or a different content management scheme (this is no law that says you must use Ajax for this).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #15
    Join Date
    Feb 2007
    Location
    Cyprus
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Encoding with two characters

    I have problem with two characters:
    ó,á
    I have fixed one , but I cannot use the replace tag for two characters. Anybody can me help?

    I have try this:
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText.replace(/á/g, 'á');
    }

    but I need insert this too: (/ó/g, 'ó');


  6. #16
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Replace is not a tag, it is a method. Whatever you call it, you can use it here as many times as you need it:

    Code:
    document.getElementById(containerid).innerHTML=page_request.responseText.replace(/á/g, 'á').replace(/ó/g, 'ó');
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #17
    Join Date
    Feb 2007
    Location
    Cyprus
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have tryed this , Its don't work. I become only one replaced letter, this will replace generally á á
    the ó ó is replaced too to á

  8. #18
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Try it again, make sure to do it just as I have shown.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #19
    Join Date
    Feb 2007
    Location
    Cyprus
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The same.

    You can see this here:
    http://www.travel4lessholidays.com/d...Italy_1_0.html

    go to weather, click on the Limassol On the bolded text the letter ó is replaced with á. This problem is only in linked text

  10. #20
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is what is in the file (ajaxtabs.js):

    Code:
    document.getElementById(containerid).innerHTML=page_request.responseText
    on the server, no replacements attempted. And, from what I can tell from looking at the page, none are needed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •