SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    symbol problem not displaying correctly

    Hi all,

    I have a cms with a rich text editor simular to the one on here when I enter a sign or "£" in the text editor it does not show a pound signit show a question mark if I just type or if i type "£" it displays just that and not sign.

    Anyone know what is going on.
    here is the link to the front end where the information appears you can see the problem under the walk options section
    http://www.meanderholidays.co.uk/ross/walks.php?walk=54

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A CMS system should "escape" content as it displays it, which is why when you type £ it shows up as exactly that. This is expected behaviour and unless your CMS has a "edit in HTML" option or similar that might get round it.

    The real problem (that is displaying as a ?) is usually related to how your pages are character encoded, in that is is displaying in the wrong encoding, so tips on how to get started on that complex subject here:

    http://www.sitepoint.com/forums/showthread.php?t=493380

  3. #3
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not really sure what that means i have read the post but doesn't really make much sense looks very confusing.

    Can I do a replace somehow in php when i pull data out of a field check for a £ sign then replace it with £ so it displays correctly in the browser.

  4. #4
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are many possibilities for this error.
    It could be mangled during the insertion into the database.

    It would help if you know what encoding is used when you submit the data and what encoding is used to store the data in the database.

    Once you know the answers for these 2 questions, you can convert from one encoding to the other. Unfortunately php does not really have a standardized way to convert between encodings.

    There are 3 different ways you can convert between encodings in php: iconv(), utf8_encode(), and mb_convert_encoding()

    Each one has various options and each of these may produce different results based on php version and on version of library it uses (like version of iconv library or mbstring extension)

    iconv() has extra option //TRANSLIT which may be a good option in your case, you should look into it.


    Worst of all, each method needs to know the encoding the string is currently in before it can convert into encoding you want it to be and there is no fool-proof way to detect the current encoding by just examining the string.

    It would be nice if some day there would be a simple function utf8_encode() that would take a string in any encoding and corrently convert it into utf8 if necessary. But untill such function exists, converting between encodings will remain a big pain.
    My project: Open source Q&A
    (similar to StackOverflow)
    powered by php+MongoDB
    Source on github, collaborators welcome!

  5. #5
    SitePoint Evangelist Dave Morton's Avatar
    Join Date
    Sep 2003
    Location
    Carson City, NV
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The numeric HTML entity for this is &#163 ; (no space, of course. )
    I'm not sure if that will help in any way, but if you're doing the coding on this CMS, then I'm sure there's a way to swap out £ for &#163 ;

    (It seems that this Rich text box, and the code that manipulates it automatically print the entities out as the actual symbols. OOPS!)
    Making a difference, one little psychotic episode at a time
    Geek Cave Creations
    Beta testers needed for pChat
    Dave's Gallery


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
  •