Results 1 to 8 of 8

 

Thread: Character coding problems

  1. #1
    andysears's Avatar
    Registered User

    Status
    Offline
    Join Date
    Dec 2005
    Location
    Herts UK
    Posts
    374
    Thanks
    3
    Thanked 2 Times in 2 Posts


    These two pages use identical character coding. Yet the first shows the pound sign as
    a question mark.

    fteam

    This URL also fails in W3C, with the message,...Sorry, I am unable to validate this document because on line 309 it contained one or more bytes that I cannot interpret as utf-8 . Yet the page below does not get the same error.

    The second one show the pound sign correctly.

    "Search, find and conmpare the cheapest attraction and theatre tickets"


    Any ideas anyone?

    cheers
    Andy
    _________________________________________
    Salou, Cambrils and PortAventura

  2. #2
    Typing with both fingers.

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Allt Y Coed Farm, North Pembrokeshire
    Posts
    4,123
    Thanks
    247
    Thanked 198 Times in 157 Posts
    I think you need to send the specific character encoding in the header of the document.

    Not sure how to do it in asp in php you send it in a header() command

    Here is a document that may explain to you:-
    Setting the HTTP charset parameter

    - I hate it when browsers mis-interpret stuff like that it really does ya head in dont it!!?

    Ta

    Baz

  3. #3
    andysears's Avatar
    Registered User

    Status
    Offline
    Join Date
    Dec 2005
    Location
    Herts UK
    Posts
    374
    Thanks
    3
    Thanked 2 Times in 2 Posts
    thanks for that, and yes its driving me mad.

    I have even cut and paste the whole header section out of the one that displays correctly and paste it in the other. Still the same.
    _________________________________________
    Salou, Cambrils and PortAventura

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Oct 2008
    Location
    Harrow
    Posts
    85
    Thanks
    3
    Thanked 12 Times in 12 Posts
    Have you tried entities instead of the £ sign?

    e.g.
    PHP Code:
    £
    or
    &
    #163; 
    I think both are valid utf-8 characters for the £ sign

  5. #5
    andysears's Avatar
    Registered User

    Status
    Offline
    Join Date
    Dec 2005
    Location
    Herts UK
    Posts
    374
    Thanks
    3
    Thanked 2 Times in 2 Posts
    HI,

    The pound sign is encoded with the vbscript formating as below.

    <%= FormatCurrency((Rec2.Fields.Item("search_price").V alue), 2, -2, -2, -2) %>

    As I say the strange thing is both sites have identical encoding, but... are on different servers, so i am wondering if that is where the problem may be.
    _________________________________________
    Salou, Cambrils and PortAventura

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Oct 2008
    Location
    Harrow
    Posts
    85
    Thanks
    3
    Thanked 12 Times in 12 Posts
    Several solutions spring to mind, but it's been a long time since I used asp and I am unable to test any of these!

    instead of formatcurrency, use formatnumber e.g.
    PHP Code:
    <%= "&pound;" FormatNumber((Rec2.Fields.Item("search_price").V alue), 2, -2, -2, -2) %> 
    or, try to correctly encode the pound sign
    PHP Code:
    <%=Server.HTMLEncode(FormatCurrency((Rec2.Fields.Item("search_price").V alue), 2, -2, -2, -2) )%> 
    or,if all else fails, change the page encoding to
    PHP Code:
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"

  7. #7
    Registered User

    Status
    Offline
    Join Date
    Jul 2009
    Posts
    50
    Thanks
    7
    Thanked 7 Times in 6 Posts
    The pound sign in your example where it doesn't work is encoded in ISO-8859-1 while your page header declares UTF-8, that's why it doesn't work.

    You need to make sure that the script that generates that pound sign generates it encoded as UTF-8, or else change the page declaration in the header to ISO-8859-1.

  8. The Following User Says Thank You to net_veteran For This Useful Post:

    andysears (09-08-09)

  9. #8
    andysears's Avatar
    Registered User

    Status
    Offline
    Join Date
    Dec 2005
    Location
    Herts UK
    Posts
    374
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Ok thanks for that.

    Changed the declaration now and pound is back.

    I still cannot see why it happened though, looking at the two page headers between the sites they are the same.

    cheers everyone

    Andy
    _________________________________________
    Salou, Cambrils and PortAventura



Thread Information

Users Browsing this Thread

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

Similar Threads

  1. CSS coding
    By rdunton in forum Programming
    Replies: 0
    Last Post: 24-02-09, 09:41 PM
  2. Replies: 6
    Last Post: 16-12-08, 05:09 PM
  3. What does hard coding mean?
    By yellowmellow in forum Affiliate Window & buy.at
    Replies: 7
    Last Post: 20-11-08, 10:32 AM
  4. Wordpress Hard Coding
    By Omicrontau in forum Programming
    Replies: 2
    Last Post: 31-01-08, 05:17 PM
  5. Coding
    By freerock in forum Programming
    Replies: 4
    Last Post: 11-07-07, 11:12 PM

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
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2