How to set encoding in gedit 3.2?












15














I can not display file coded with GBK.
In gconf-editor of gnome 3.2 , I can not find encoding item of gedit .
How to set it ?
thanks










share|improve this question






















  • What is the output of locale and locale -a?
    – enzotib
    Jan 24 '12 at 8:58
















15














I can not display file coded with GBK.
In gconf-editor of gnome 3.2 , I can not find encoding item of gedit .
How to set it ?
thanks










share|improve this question






















  • What is the output of locale and locale -a?
    – enzotib
    Jan 24 '12 at 8:58














15












15








15


9





I can not display file coded with GBK.
In gconf-editor of gnome 3.2 , I can not find encoding item of gedit .
How to set it ?
thanks










share|improve this question













I can not display file coded with GBK.
In gconf-editor of gnome 3.2 , I can not find encoding item of gedit .
How to set it ?
thanks







gedit






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 24 '12 at 8:39









waterloo2005

88282040




88282040












  • What is the output of locale and locale -a?
    – enzotib
    Jan 24 '12 at 8:58


















  • What is the output of locale and locale -a?
    – enzotib
    Jan 24 '12 at 8:58
















What is the output of locale and locale -a?
– enzotib
Jan 24 '12 at 8:58




What is the output of locale and locale -a?
– enzotib
Jan 24 '12 at 8:58










3 Answers
3






active

oldest

votes


















30














I don't have a file encoded in GBK to test the solutions, but do try them.



Option 1: Run gedit and then open the file:




  • run gedit


  • click open


  • select in the encoding combo "add" and add GB18030 (or GBK)


  • select that encoding in the combo


  • select the file



Option 2:




  • install and run gconf-editor



  • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:



    [CURRENT,GB18030,GBK,GB2312,UTF-8,UTF-16]



Remember to backup the previous value of auto_detected!!



Option 3:
Using dconf (the "newer" gconf, used in ubuntu)



dconf read /org/gnome/gedit/preferences/encodings/auto-detected


Save the result (backup)!



dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


Sources:




  • https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/819714

  • https://bugzilla.redhat.com/show_bug.cgi?id=576047#c2

  • http://ubuntuforums.org/showthread.php?t=1456308

  • http://forum.ubuntu-gr.org/viewtopic.php?p=221205&http#p221205


To reset it to default:
a) use the option you backed up from dconf read command



or b) try:



dconf reset /org/gnome/gedit/preferences/encodings/auto-detected





share|improve this answer





















  • Unexpected error: Invalid byte sequence in conversion input
    – vipin8169
    Mar 31 '16 at 6:26



















2














If you want do it quick then install medit. All works from the box.



If you still want use gedit then you need do some work:





  1. Set auto-detect



    gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"


  2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly



"Change encoding" plugin for gedit v3



# Download plugin
mkdir -p /tmp/encoding
cd /tmp/encoding
wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
tar -xzvf gedit-encoding-plugin.tar.gz

# Copy to plugins directory
mkdir -p ~/.local/share/gedit/plugins
cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

# Remove /tmp/encoding
rm -Rf /tmp/encoding


Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"



Plugin description:
https://aur.archlinux.org/packages/gedit-encoding-plugin/



Plugin for gedit v2. Same author as in plugin above:
http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive)
or plugin for gedit v2 by another author:
http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/



!!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...






share|improve this answer































    1














    Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'.
    And 'auto-detected' is replaced by 'candidate-encodings' :



    dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"





    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f98036%2fhow-to-set-encoding-in-gedit-3-2%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      30














      I don't have a file encoded in GBK to test the solutions, but do try them.



      Option 1: Run gedit and then open the file:




      • run gedit


      • click open


      • select in the encoding combo "add" and add GB18030 (or GBK)


      • select that encoding in the combo


      • select the file



      Option 2:




      • install and run gconf-editor



      • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:



        [CURRENT,GB18030,GBK,GB2312,UTF-8,UTF-16]



      Remember to backup the previous value of auto_detected!!



      Option 3:
      Using dconf (the "newer" gconf, used in ubuntu)



      dconf read /org/gnome/gedit/preferences/encodings/auto-detected


      Save the result (backup)!



      dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


      Sources:




      • https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/819714

      • https://bugzilla.redhat.com/show_bug.cgi?id=576047#c2

      • http://ubuntuforums.org/showthread.php?t=1456308

      • http://forum.ubuntu-gr.org/viewtopic.php?p=221205&http#p221205


      To reset it to default:
      a) use the option you backed up from dconf read command



      or b) try:



      dconf reset /org/gnome/gedit/preferences/encodings/auto-detected





      share|improve this answer





















      • Unexpected error: Invalid byte sequence in conversion input
        – vipin8169
        Mar 31 '16 at 6:26
















      30














      I don't have a file encoded in GBK to test the solutions, but do try them.



      Option 1: Run gedit and then open the file:




      • run gedit


      • click open


      • select in the encoding combo "add" and add GB18030 (or GBK)


      • select that encoding in the combo


      • select the file



      Option 2:




      • install and run gconf-editor



      • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:



        [CURRENT,GB18030,GBK,GB2312,UTF-8,UTF-16]



      Remember to backup the previous value of auto_detected!!



      Option 3:
      Using dconf (the "newer" gconf, used in ubuntu)



      dconf read /org/gnome/gedit/preferences/encodings/auto-detected


      Save the result (backup)!



      dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


      Sources:




      • https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/819714

      • https://bugzilla.redhat.com/show_bug.cgi?id=576047#c2

      • http://ubuntuforums.org/showthread.php?t=1456308

      • http://forum.ubuntu-gr.org/viewtopic.php?p=221205&http#p221205


      To reset it to default:
      a) use the option you backed up from dconf read command



      or b) try:



      dconf reset /org/gnome/gedit/preferences/encodings/auto-detected





      share|improve this answer





















      • Unexpected error: Invalid byte sequence in conversion input
        – vipin8169
        Mar 31 '16 at 6:26














      30












      30








      30






      I don't have a file encoded in GBK to test the solutions, but do try them.



      Option 1: Run gedit and then open the file:




      • run gedit


      • click open


      • select in the encoding combo "add" and add GB18030 (or GBK)


      • select that encoding in the combo


      • select the file



      Option 2:




      • install and run gconf-editor



      • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:



        [CURRENT,GB18030,GBK,GB2312,UTF-8,UTF-16]



      Remember to backup the previous value of auto_detected!!



      Option 3:
      Using dconf (the "newer" gconf, used in ubuntu)



      dconf read /org/gnome/gedit/preferences/encodings/auto-detected


      Save the result (backup)!



      dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


      Sources:




      • https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/819714

      • https://bugzilla.redhat.com/show_bug.cgi?id=576047#c2

      • http://ubuntuforums.org/showthread.php?t=1456308

      • http://forum.ubuntu-gr.org/viewtopic.php?p=221205&http#p221205


      To reset it to default:
      a) use the option you backed up from dconf read command



      or b) try:



      dconf reset /org/gnome/gedit/preferences/encodings/auto-detected





      share|improve this answer












      I don't have a file encoded in GBK to test the solutions, but do try them.



      Option 1: Run gedit and then open the file:




      • run gedit


      • click open


      • select in the encoding combo "add" and add GB18030 (or GBK)


      • select that encoding in the combo


      • select the file



      Option 2:




      • install and run gconf-editor



      • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:



        [CURRENT,GB18030,GBK,GB2312,UTF-8,UTF-16]



      Remember to backup the previous value of auto_detected!!



      Option 3:
      Using dconf (the "newer" gconf, used in ubuntu)



      dconf read /org/gnome/gedit/preferences/encodings/auto-detected


      Save the result (backup)!



      dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


      Sources:




      • https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/819714

      • https://bugzilla.redhat.com/show_bug.cgi?id=576047#c2

      • http://ubuntuforums.org/showthread.php?t=1456308

      • http://forum.ubuntu-gr.org/viewtopic.php?p=221205&http#p221205


      To reset it to default:
      a) use the option you backed up from dconf read command



      or b) try:



      dconf reset /org/gnome/gedit/preferences/encodings/auto-detected






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 24 '12 at 10:43









      Savvas Radevic

      6,35213244




      6,35213244












      • Unexpected error: Invalid byte sequence in conversion input
        – vipin8169
        Mar 31 '16 at 6:26


















      • Unexpected error: Invalid byte sequence in conversion input
        – vipin8169
        Mar 31 '16 at 6:26
















      Unexpected error: Invalid byte sequence in conversion input
      – vipin8169
      Mar 31 '16 at 6:26




      Unexpected error: Invalid byte sequence in conversion input
      – vipin8169
      Mar 31 '16 at 6:26













      2














      If you want do it quick then install medit. All works from the box.



      If you still want use gedit then you need do some work:





      1. Set auto-detect



        gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"


      2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly



      "Change encoding" plugin for gedit v3



      # Download plugin
      mkdir -p /tmp/encoding
      cd /tmp/encoding
      wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
      tar -xzvf gedit-encoding-plugin.tar.gz

      # Copy to plugins directory
      mkdir -p ~/.local/share/gedit/plugins
      cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

      # Remove /tmp/encoding
      rm -Rf /tmp/encoding


      Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"



      Plugin description:
      https://aur.archlinux.org/packages/gedit-encoding-plugin/



      Plugin for gedit v2. Same author as in plugin above:
      http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive)
      or plugin for gedit v2 by another author:
      http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/



      !!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...






      share|improve this answer




























        2














        If you want do it quick then install medit. All works from the box.



        If you still want use gedit then you need do some work:





        1. Set auto-detect



          gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"


        2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly



        "Change encoding" plugin for gedit v3



        # Download plugin
        mkdir -p /tmp/encoding
        cd /tmp/encoding
        wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
        tar -xzvf gedit-encoding-plugin.tar.gz

        # Copy to plugins directory
        mkdir -p ~/.local/share/gedit/plugins
        cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

        # Remove /tmp/encoding
        rm -Rf /tmp/encoding


        Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"



        Plugin description:
        https://aur.archlinux.org/packages/gedit-encoding-plugin/



        Plugin for gedit v2. Same author as in plugin above:
        http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive)
        or plugin for gedit v2 by another author:
        http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/



        !!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...






        share|improve this answer


























          2












          2








          2






          If you want do it quick then install medit. All works from the box.



          If you still want use gedit then you need do some work:





          1. Set auto-detect



            gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"


          2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly



          "Change encoding" plugin for gedit v3



          # Download plugin
          mkdir -p /tmp/encoding
          cd /tmp/encoding
          wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
          tar -xzvf gedit-encoding-plugin.tar.gz

          # Copy to plugins directory
          mkdir -p ~/.local/share/gedit/plugins
          cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

          # Remove /tmp/encoding
          rm -Rf /tmp/encoding


          Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"



          Plugin description:
          https://aur.archlinux.org/packages/gedit-encoding-plugin/



          Plugin for gedit v2. Same author as in plugin above:
          http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive)
          or plugin for gedit v2 by another author:
          http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/



          !!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...






          share|improve this answer














          If you want do it quick then install medit. All works from the box.



          If you still want use gedit then you need do some work:





          1. Set auto-detect



            gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"


          2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly



          "Change encoding" plugin for gedit v3



          # Download plugin
          mkdir -p /tmp/encoding
          cd /tmp/encoding
          wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
          tar -xzvf gedit-encoding-plugin.tar.gz

          # Copy to plugins directory
          mkdir -p ~/.local/share/gedit/plugins
          cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

          # Remove /tmp/encoding
          rm -Rf /tmp/encoding


          Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"



          Plugin description:
          https://aur.archlinux.org/packages/gedit-encoding-plugin/



          Plugin for gedit v2. Same author as in plugin above:
          http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive)
          or plugin for gedit v2 by another author:
          http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/



          !!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 23 '15 at 8:56









          sancelot

          1032




          1032










          answered Nov 23 '14 at 20:45









          user3439968

          19114




          19114























              1














              Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'.
              And 'auto-detected' is replaced by 'candidate-encodings' :



              dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"





              share|improve this answer


























                1














                Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'.
                And 'auto-detected' is replaced by 'candidate-encodings' :



                dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"





                share|improve this answer
























                  1












                  1








                  1






                  Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'.
                  And 'auto-detected' is replaced by 'candidate-encodings' :



                  dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"





                  share|improve this answer












                  Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'.
                  And 'auto-detected' is replaced by 'candidate-encodings' :



                  dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 17 '18 at 5:28









                  zhuhai

                  111




                  111






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f98036%2fhow-to-set-encoding-in-gedit-3-2%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Quarter-circle Tiles

                      build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                      Mont Emei