Results 1 to 4 of 4
  1. #1
    Knedlikova is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default Help - special characters producing 404 errors

    Hi all,

    Am a complete Java novice / HTML rookie, but somehow managed to set up the below redirect on my blog so it routes page to page.

    I have managed to set up a re-direct from old to new blog with javascript, so that it works page by page. Only problem is that the posts that have special characters in e.g. return a 404 error, even when I have removed the characters from the links in question.

    Sure there is a simple solution, but I have absolutely no idea how to go about finding it. Any hints much appreciated (please word as simply as possible!)

    Thanks,

    Knedlikova


    <b:widget id='Redirector' locked='true' title='Blog Posts' type='Blog'>
    <b:includable id='main'>
    <b:if cond='data:blog.pageType == "item"'>
    <b:loop values='data:posts' var='post'>
    <div id='redirectorTitle' style='visibility:hidden'><data:post.title/></div>
    <script type='text/javascript'>
    var new_domain = 'http://dobrou-chut.com'

    function utf8_uri_encode( str ) {
    var high_code = new RegExp(/[\u0080-\uffff]+/);;
    new_str = str;;
    while( m = high_code.exec( new_str ) ) {
    new_str = new_str.replace(m,encodeURIComponent(m));;
    }
    return new_str;;
    }

    var title = document.getElementById('redirectorTitle').innerHT ML;;
    // [INCOMPLETE] Keep percent signs that aren't part of an octet?
    title = title.replace(/&lt;[^&gt;]*?&gt;/g,'');; // remove tags
    title = title.replace(/&amp;.+?;/g,'');; // remove entities
    title = utf8_uri_encode(title);; // handle UTF-8 characters
    title = title.toLowerCase();;
    title = title.replace(/[^%a-z0-9 _-]/g,'');; // remove punctuation
    title = title.replace(/\s+/g,'-');; // turn spaces into hyphens
    title = title.replace(/-+/g, '-');; // collapse runs of hyphens
    title = title.replace(/^-+/g,'');; // remove prefixed hyphens
    title = title.replace(/-+$/g,'');; // remove suffixed hyphens
    var timestamp = '<data:post.timestamp/>';
    timestamp = timestamp.split('/');
    timestamp = timestamp[2]+'/'+timestamp[0]+'/'+timestamp[1];
    var new_page = new_domain + '/' + title + '/';;
    document.location.href = new_page;
    </script>
    </b:loop>
    </b:if>
    </b:includable>
    </b:widget>

  2. #2
    venerik is offline Member
    Join Date
    Oct 2010
    Posts
    94
    Rep Power
    0

    Default

    The code in your post is Javascript. This is a Java forum. These languages are not related. I suggest you find a Javascript forum.

    Cheers,
    Erik
    I'm new to Java but I like to help where ever I can. :)

  3. #3
    Knedlikova is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default

    They might have named the two a little more clearly in that case!

  4. #4
    venerik is offline Member
    Join Date
    Oct 2010
    Posts
    94
    Rep Power
    0

Similar Threads

  1. XML with special characters
    By Kaizah in forum XML
    Replies: 1
    Last Post: 11-06-2009, 02:26 PM
  2. [SOLVED] special characters (ASCII)
    By AlejandroPe in forum New To Java
    Replies: 8
    Last Post: 04-06-2009, 10:42 AM
  3. Searching for Microsoft special characters
    By Tim McDaniel in forum Eclipse
    Replies: 2
    Last Post: 02-24-2009, 03:11 PM
  4. special characters
    By ravian in forum New To Java
    Replies: 2
    Last Post: 11-16-2007, 01:28 PM
  5. Special characters in text fields
    By Felissa in forum Web Frameworks
    Replies: 0
    Last Post: 06-27-2007, 04:47 PM

Posting Permissions

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