Menu

Character Encoding - Change view instantly

Arheos
2009-07-13
2012-11-13
  • Arheos

    Arheos - 2009-07-13

    Is there a way to change the character encoding while editing a document? I'm sure not everyone uses/edit files only from their own country's encoding and it's not convienient to change the default encoding every time you open a document.
    Of course this applies to ANSI only encoded files.
    I haven't found a way to do that but maybe I'm not using N++ to the full extent.
    Thanks

     
    • Arheos

      Arheos - 2009-09-03

      I can't figure how to work it out. My file is ANSI, russian, CP1251. I put 1251 in the macro settings. I have the locale in the language bar and nothing happens running the macro. Why does it have to be UCS2 on the format? I didn't create the file to choose it, it's already ANSI. My windows setup isn't russian but I can see them displayed fine in Unicode/ANSI in Firefox.
      (Of course I have no problems with Unicode in N++ either)
      Maybe it's because I didn't change the styleID in stylers.xml but it's a labyrinth in there and I'm not sure which one I should change.
      In any case not the default because these non-latin files (well russian here) just pop up now and again and I don't want to alter the default style.
      I don't know if it makes any difference but it's Windows2000.
      Thanks

       
    • cchris

      cchris - 2009-07-15

      Just change the font for Global styles -> Default style to one that displays the 128.255 character range according to what you expect. A greek font for greek text, arabic font for arabic and usually farsi text, etc...

      CChris

       
    • Arheos

      Arheos - 2009-07-15

      Maybe I wasn't very clear on this. I meant an "easy way" in a manner similar to that of Firefox: View->Character encoding. The not convenient part I mentioned is exactly this, going to the settings everytime you have a differently encoded file.

       
    • Michel Merlin

      Michel Merlin - 2009-07-15

      (Sorry for the dense title. The forum forced me to do so)
      ---

      I agree with "Arheos"; how to see or edit character encoding is far from as clear in Notepad++ as it is in IE or OE (see http://groups.google.com/group/microsoft.public.outlookexpress.general/browse_frm/thread/d7a4c969ef3c8412 « For Long URLs, Accentuated Chars, encode as Quoted-Printable, Western European (ISO), use "EUR" for Euro symbol ») or Firefox or Safari.

      In Notepad++ I found nothing but "Notepad++ > Settings > Preferences > Global > Localization", which is not clear about what exactly it does, and which probably does NOT address charsets (or it would show it clearly, as other programs are doing).

      Please "christian cuvier" be more precise and exact: I didn't find what you mean "Global styles -> Default style" or how you can, in Notepad++, "displays the 128.255 character range according to what you expect" (which means, if I understand you correctly, choosing one of the *fixed length* charsets, thus excluding UTF-8).

      Now I assume "Arheos" was addressing the encoding of *the Notepad document itself*. Otherwise, if that document is the code for an HTML document, then of course that code should include the appropriate « META ... Content-Type ... charset=... » tag (making the HTTP headers supersede the internal META is IMO one of the big faults made by W3C and propagated everywhere, inducing most of the charset errors that plague millions people daily).

      Versailles, Wed 15 Jul 2009 14:22:00 +0200

       
    • cchris

      cchris - 2009-07-15

      > In Notepad++ I found nothing but "Notepad++ > Settings > Preferences > Global > Localization", which is not clear about what exactly it does, and which probably does NOT address charsets (or it would show it clearly, as other programs are doing).

      This configuration item relates to the localisation of the Notepad++ application. Changing it causes menu entries, dialog box labels etc to conform to the chosen language. It works on he fly - you don't need to close the Preferences dialog to see the effect.

      The term "localisation" is the precise, technical term which designates the process of choosing the language for a user interface, and this is precisely what the item does.

      > Please "christian cuvier" be more precise and exact: I didn't find what you mean "Global styles -> Default style" or how you can, in Notepad++, "displays the 128.255 character range according to what you expect" (which means, if I understand you correctly, choosing one of the *fixed length* charsets, thus excluding UTF-8). 

      Settongs -> Stylers Configurator , select Global styles on the lefthand list and Default style on the right hand list. If you are viewing a file using some highlighter (PHP, HTML,...) and you have set a specific font for the DEFAULT style item, then refer to this font instead.

      Old time fonts, sometimes called DOS fonts, encode characters over one byte, so indeed they are not UTF-8 capable. The 0..127 character range is usually the same for all fonts, and is specified by the ASCII (the S is for standard). What happens on the upper half is up to each font.

      To try putting some order, it was decided that fonts representing a given script should have consistent layouts for this upper 128..255 range. IDs for the scripts are known as the _code page_ for the font. Thus, if you wish to read text with greek charactters and an ANSI-like font, choose a font with he greek code page - 737 I believe. If you view greek text with a russian font, you'll see random cyrillic letters which won't make sense as greek text.

      Notepad++ does not have a ofont manager in order to select the right font for a given document. However, there are 3rd party free managers. I use Arjan Mels' Font Viewr, but here are others. I don't know if a font manager plugin would be very useful, but why not.

      In the cyrillic script world, things are more complicated because there are two code pages, 866 and 1251, known as KOI-8 and Windows-1251.

      Languages with too many glyphs have used DBCS encodings, also with code pages; this is yet another story. Other people on this forum probably know the gory details better.

      Modern fonts adhere to the Unicode standard and refer to code pages for compatibility only. Since they have as many glyphs as desired, they can support several of them, which older fonts could not.

      HTH
      CChris

       
    • Michel Merlin

      Michel Merlin - 2009-07-15

      Thx "christian cuvier" for your 2009-07-15 16:43 timely reply.

      « The term "localisation"... »
      In my Notepad++ 5.3.1 (UNICODE) of 29 Mar 2009, it is written the US way ("Localization").

      « ...choosing the language for a user interface »
      This is precisely what made your post uncertain since it was replying to someone asking NOT about languages, NOT about fonts, BUT about *charsets* (or character encoding).

      « Settongs -> Stylers Configurator... »
      "Notepad++ > Settings > Style Configurator > Global Styles: Default Style" is visibly about the *fonts* that will be used in Notepad++ interface, NOT about the character encoding of the document being edited.

      « Old time fonts, sometimes called DOS fonts, encode characters over one byte... »
      We are talking here of *charsets*, NOT of *code pages* (neither DOS nor Windows) or of "fonts". Confusion is frequent (from everyone), so please for your particular question, see my reply #7 or #8 to Jim Pickering, "OEM code pages (DOS) ==» ANSI code pages (Windows) ==» ISO charsets ==» UTF (Unicode)" of Wed 17 Jan 2007 in thread:
      http://groups.google.com/group/microsoft.public.outlookexpress.general/browse_frm/thread/4a52ed2c43276354
      "OE (Outlook Express) can't edit HTML source of UTF-8 European messages".

      Versailles, Thu 16 Jul 2009 00:53:20 +0200

       
    • cchris

      cchris - 2009-07-16

      > « ...choosing the language for a user interface »
      This is precisely what made your post uncertain since it was replying to someone asking NOT about languages, NOT about fonts, BUT about *charsets* (or character encoding).

      I would disagree with your interpretation of the initial post.

      > « Settongs -> Stylers Configurator... »
      "Notepad++ > Settings > Style Configurator > Global Styles: Default Style" is visibly about the *fonts* that will be used in Notepad++ interface, NOT about the character encoding of the document being edited.

      Wrong. Try it for yourself. It affects how normal text is being displayed in _documents_, and is the fallback for a number of built-in languages. I don't think the _user interface_ font can be changed at all from inside Notepad++. I haven't checked whether it is hardcoded as the default system fon (or the system font for the chosen user locale if available)t, but I'd suspect this.

      CChris

       
    • Arheos

      Arheos - 2009-07-24

      (Away at the time of the replies)
      To clear any misunderstanding I didn't ask about Notepad++ localisation itself, only about the file under editing at the time.
      Chris answered my initial post in his first reply about the way Notepad++ can cope with different ANSI encoded files but that was my question/possible proposal/feature for an easy way to change the encodings instead of going through the options and Global styles.
      Chris, is it possible to have a similar to Firefox "on-the-fly" way of changing it?
      Thanks again.

       
    • cchris

      cchris - 2009-07-24

      See http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Wrong_Display_Of_Non_Latin_Characters .You'll find a synthetic macro there for changing a character set. You'lll have to design one macro by style / charset pair.

      So it should be possible - post the request on IdeaTorrent.

      CChris

       
MongoDB Logo MongoDB