www.webdeveloper.com
Results 1 to 5 of 5

Thread: Euro sign shows up only if i refresh

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    9

    Euro sign shows up only if i refresh

    I'm interning at a company and my job is to fix glitches on their website.
    I'm trying to explain this as well as I can.
    On the edit page of projects for some reason the sign does not show properly.
    I got this partly fixed.
    This is what the code looked like
    PHP Code:
            if($key != 'title')
            {
                
    $value utf8_decode($value);
            }
            
            
    // title and content are post properties so they are updated differently
            
    if($key == 'title')
            {
                
    $newpost = array();
                
    $newpost['ID'] = $pid;
                
    $newpost['post_title'] = $DRAFT_STRING $value;
                
    wp_update_post($newpost);
            }
            elseif(
    $key == 'content')
            {
                
    $newpost = array();
                
    $newpost['ID'] = $pid;
                
    $newpost['post_content'] = stripslashes(htmlentities($value));
                
    wp_update_post($newpost);
            }
            elseif(
    $key == 'category')
            {
                
    wp_set_post_categories($pid, Array($value));
            }
            else
            {
                
    // We are dealing with metadata
                
    $value stripslashes(htmlentities($value));
                
    update_post_meta($pid$key$value);
            }
            
            
    // If we are dealing with video, format tags
            
    if($key == 'Video'$value stripslashes(htmlentities($value));
            
            if(
    $key == 'content' || $key == 'info'
            {
                
    $value apply_filters('the_content'$value);
                
    $value utf8_encode($value);
            } 
    So I tried to change the utf-8_decode to iconv("UTF-8", "CP-1252", $value); but had little success.
    What I found out to work was this

    PHP Code:
    if($key != 'title')
            {
                
    htmlentities($valueENT_QUOTES|"ENT_HTML5""UTF-8"true);
            }
            
            
    // title and content are post properties so they are updated differently
            
    if($key == 'title')
            {
                
    $newpost = array();
                
    $newpost['ID'] = $pid;
                
    $newpost['post_title'] = $DRAFT_STRING $value;
                
    wp_update_post($newpost);
            }
            elseif(
    $key == 'content')
            {
                
    $newpost = array();
                
    $newpost['ID'] = $pid;
                
    $newpost['post_content'] = stripslashes(htmlentities($valueENT_QUOTES|"ENT_HTML5""UTF-8"true));
                
    wp_update_post($newpost);
            }
            elseif(
    $key == 'category')
            {
                
    wp_set_post_categories($pid, Array($value));
            }
            else
            {
                
    // We are dealing with metadata
                
    $value stripslashes(htmlentities($valueENT_QUOTES|"ENT_HTML5""UTF-8"true));
                
    update_post_meta($pid$key$value);
            }
            
            
    // If we are dealing with video, format tags
            
    if($key == 'Video'$value stripslashes(htmlentities($value));
            
            if(
    $key == 'content' || $key == 'info'
            {
                
    $value apply_filters('the_content'$value);
                
    $value utf8_encode($value);
            }
            
            echo 
    $value;
        } 
    But as I save the forms instead of a euro sign there is a €. But on one of the forms it shows the sign. And as I refresh the € has changed to a .

    Hope I was clear enough, thanks!

  2. #2
    Join Date
    Feb 2014
    Posts
    9
    Okay I got it fixed by putting $value = htmlentities($value, ENT_QUOTES|"ENT_HTML5", "UTF-8", true); into the category and info key, but now in the info everything i write show inside a <p> tag, until i refresh.

  3. #3
    Join Date
    Feb 2014
    Posts
    9
    got it, removed apply_filters and it works! lock please

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,413
    Lock what?
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  5. #5
    Join Date
    Feb 2014
    Posts
    9
    This thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles