1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Saving a php file with emojis

Discussion in 'PHP' started by qwikad.com, Jun 19, 2019.

  1. #1
    When I replace an HTML emoji with its code and try to save the page:

    $text = preg_replace("/ 2.gif /", "😃", $text);

    I get a message saying something like "Some elements may not be saved properly since you have encoding windows-1251 elements, etc.".

    If I go on and save the page, the code after the preg_replace gets cut off and the emoji 2.gif looks like some crazy code.

    Is there a way to save a php page with HTML emojis in it?
     
    qwikad.com, Jun 19, 2019 IP
  2. luckyd4r

    luckyd4r Peon

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #2
    there is one great thing I like about internet - you can find everything here!
    Okay, so I can see that there is a topic about it in stackoverflow, maybe it will help you. Here you go: https://stackoverflow.com/questions/34621541/why-dont-emojis-render-in-my-html-and-or-php
     
    luckyd4r, Jun 19, 2019 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #3
    The declaration is correct in my case (<meta charset="utf-8">). I am beginning to wonder if what I am trying to do is even possible.
     
    qwikad.com, Jun 19, 2019 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    try this
    utf8_encode(string)
    Code (markup):
     
    sarahk, Jun 19, 2019 IP
    qwikad.com likes this.
  5. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #5
    You know what's weird? When I put something like:
    $emoji_help = "৳¥₹₮₱₩฿₫₡₣₦₽₪";
    Code (markup):
    right above this $text = preg_replace("/ [​IMG] /", "&#128515;", $text); and other emoji preg_replaces, it saves the page just fine. Not sure what's behind that. I will try what you suggested since it's the right way to do it, I am sure.
     
    qwikad.com, Jun 19, 2019 IP
  6. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #6
    How can anyone answer this question? It's not clear what the original poster is asking for or trying to do...

    Are you trying to save a Web Page outputted from a PHP script or an actual PHP script?
    Is the Internet Browser giving you that warning message or is your editor?
    Are you concern with OTHERS being able to correctly save the page or just yourself?

    Let's start there..
     
    NetStar, Jun 21, 2019 IP