Jump to content

problem in viewing emoji !!!


 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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

Β 

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...