Jump to content
AlienStar

problem in viewing emoji !!!

Recommended Posts

AlienStar

hello everybody

when I paste emoji in "input box' to be saved in an "ini file" it's saved as question marks "?????"

although when I paste the emoji in every edited place it's saved properly

how to fix please ??

example: 😀 😃 😄 😷 🤒 🤕

#include <GUIConstantsEx.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example",200,200)
    Local $hinput = GUICtrlCreateInput("",25,25,150,25)
    Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            case $idOK
                $emoji = GUICtrlRead($hinput,1)
                MsgBox(0,"",$emoji )
                IniWrite("emoji.ini","1","key=",$emoji)
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

Edited by AlienStar

Share this post


Link to post
Share on other sites
BrewManNH

Pictures aren't text, you can't place a picture in an ini file.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
AlienStar
1 minute ago, BrewManNH said:

Pictures aren't text, you can't place a picture in an ini file.

when I paste it manually in any text file it's saved properly !!!

Share this post


Link to post
Share on other sites
BrewManNH

The picture is?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
AlienStar
3 minutes ago, BrewManNH said:

The picture is?

no it's not picture but character

try to copy emoji from the first post then paste in a text file

Edited by AlienStar

Share this post


Link to post
Share on other sites
AlienStar

Untitled-1.jpg

Share this post


Link to post
Share on other sites
BrewManNH

Ini files are not generic text files, and have VERY specific formatting rules. Random pictures aren't part of that. Use another type of file and don't use IniWrite/IniRead with it.

  • Like 1

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
AlienStar

I try to save in text file but the same problem !!!

although when I send it in MsgBox it's sent properly !

Share this post


Link to post
Share on other sites
trancexx

You have to set proper encoding for the ini before writing to it. Maybe like this:

Example()

Func Example()
    ; Set proper encoding for the ini file
    FileClose(FileOpen("emoji.ini", 32 + 1 + 8))

    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 200, 200)
    Local $hinput = GUICtrlCreateInput("", 25, 25, 150, 25)
    Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case -3
                ExitLoop
            Case $idOK
                $emoji = GUICtrlRead($hinput, 1)
                IniWrite("emoji.ini", "1", "emoji", $emoji)
                MsgBox(0, "", IniRead("emoji.ini", "1", "emoji", ""))
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc

 

  • Like 1

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
AlienStar
On 11/18/2017 at 7:12 AM, trancexx said:

You have to set proper encoding for the ini before writing to it. Maybe like this:

Example()

Func Example()
    ; Set proper encoding for the ini file
    FileClose(FileOpen("emoji.ini", 32 + 1 + 8))

    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 200, 200)
    Local $hinput = GUICtrlCreateInput("", 25, 25, 150, 25)
    Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case -3
                ExitLoop
            Case $idOK
                $emoji = GUICtrlRead($hinput, 1)
                IniWrite("emoji.ini", "1", "emoji", $emoji)
                MsgBox(0, "", IniRead("emoji.ini", "1", "emoji", ""))
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc

 

that is the solution, it works fine :)

thanks so much

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×