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?
    SEMrush
     
    qwikad.com, Jun 19, 2019 IP
    SEMrush
  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:
    5,861
    Likes Received:
    1,085
    Best Answers:
    22
    Trophy Points:
    400
    #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:
    25,186
    Likes Received:
    3,428
    Best Answers:
    100
    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:
    5,861
    Likes Received:
    1,085
    Best Answers:
    22
    Trophy Points:
    400
    #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,266
    Likes Received:
    467
    Best Answers:
    21
    Trophy Points:
    215
    #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