I'm facing a rather nasty problem. In Matlab, the command S = char(1044) puts Russian letter д into variable S. However disp(S) returns blank symbols, though the content is actually correct:
>> S = char(1044);
>> disp(S)
>> disp(S-0)
1044
How can I make Matlab show Russian letters in the command window?
I am not sure it will help, but check out this:
The custom font preferences for the Editor and Command windows in MATLAB must be set to monospaced, plain. Go to File->Preferences->Fonts->Custom. Select 'Editor' or 'Command Window' from the text box and change the font preferences.
Taken from:
http://www.mathworks.com/support/solutions/en/data/1-8V70TK/index.html?product=ML&solution=1-8V70TK
Related
I am new to notepad++ and like it very much, since I can customize how my text documents look more easily than with wordpad. However, I would like to know if it’s possible to enter accented characters like in wordpad (I thought it was a windows thing, but perhaps it isn’t). In wordpad, I can type, for instance, ctrl-’ then i to get an accented í character. Similarly, I can type ctrl-shift-~ then n to get the accented ñ character. It makes it much easier to enter accented characters than copying and pasting from the character map application, or trying to remember code points. When I tried this method in notepad++ I just got the plain character without the accents. I should also mention that when I open documents with such accented characters already present they appear just as expected. Is there a way to enter accented characters like this in notepad++ using only the keyboard? I am using the latest notepad++ under Windows 7.
In Notepad++ you can go to “Edit” then select “Character Panel” near the bottom of the drop down menu. It will show you the ASCII set available which includes most accented characters. You find the character you want and there will be a number for it, to easily use that, press and hold your ALT key, then, on your keypad on the right side of your keyboard type zero followed by the number for that character. So for something like “ñ” for example, the code for it is 241, so you would press ALT and then type 0241 on the keypad while holding down ALT and you will get the character you need. That works in most Windows programs, even in here.
This only works for ASCII characters in the range of 0 to 255. I don't know of a method other than copying and pasting from the “Character Map” app available in Windows for Unicode. Though I did test Wordpad with the Decimal number of the Hex value you see for a Unicode character above 255 and it will work with the ALT+#### in there, and probably other places, but it doesn't work in Notepad or Notepad++ for some strange reason, sadly. Two I use a lot and have memorized are ALT+0147 and ALT+0148 for the quotation marks “like these”, so once you use the numbers enough you tend to get used to them, or you can jot down the ones you use the most.
For anyone searching for a solution and coming across this page, try this (Windows): install and use the US International keyboard instead of the plain US keyboard. Search for "windows keyboard us international install" or something similar. I liked the techlanguage.com write-up on it and the teckangaroo.com step by step on how to install. Hope this helps someone in future looking around as I was earlier today for how to easily meet this need.
You can make your own keyboard layout to enter arbitrary characters anywhere in Windows, using MSKLC. Here's one I made earlier.
I think it is configured in the input method. With input method containing the characters you mentioned, you can press key combinations to get special letters.
You can add a keyboard layout preset in Windows. Under "Language and Regions" - "Language" - "Language settings" - "Input method" settings in Control Panel, you can add all what you want. Like this:
Switch keyboard layout with Alt + Shift.
I just wondered why my m-files from MATLAB look so different when I open them with Notepad++ instead of the built-in MATLAB Editor.
It seems that in the MATLAB Editor each character has the same width. Not so in Notepad++ (even I change the language to "M").
Here's a screenshot from a file opened in Notepad++ (left) and in the MATLAB Editor (right).
In the MATLAB Editor all the characters in column X are exactly one below the other. They aren't in Notepad++.
I just played a bit with the tab preferences, without any success.
Is there a way to get the alignment of columns in Notepad++ the same as in the MATLAB Editor ...at least for m-files?
It's because your MATLAB Editor is set to use a monospaced font such as Courier (i.e. a font where all the characters are designed to have exactly the same width), but your Notepad++ is not.
In Notepad++, you can set the font with the menu Settings -> Style Configurator. Select "MATLAB" from the language list (or in fact you may like to select "Global Styles", to do this for all languages), and set the font to a monospaced font such as Courier.
Alternatively, you may like to download a more modern programming font such as Consolas, ProFont, Monofur, Proggy, or Inconsolata. These are all monospaced, and nicer than Courier. You can use the in both Notepad++ and the MATLAB Editor.
It's possible that another issue might be that you have tab characters in your code, which are displaying with a variable width in Notepad++. You can make sure that MATLAB replaces tab characters with spaces in the MATLAB preferences (MATLAB->Editor/Debugger/Tab). To check whether you have tab characters, open the file in Notepad++ and select View->Show Symbol->Show All Characters. Tab characters will display as a short arrow, and space characters will display as a little dot. If you need to change all the tabs to spaces in an existing file, Notepad++ can do this with Edit->Blank Operations->Tab to Space.
Hope that helps!
To add to Sam's answer, choosing a monospaced font specific to your environment's language is recommended. For instance, Courier New on Japanese language may not have the desired result. Choose MS Gothic (for Windows) or Osaka (for Mac) instead.
The problem I have can be re-produced by pasting this code into PyCharm:
chinese = [u'这', u'是', u'一', u'些', u'中', u'文']
print chinese
When you set a breakpoint at the print line and start debugging, you could see tha the variable chinese in the watch window is displayed as
[u'\u8fd9', u'\u662f', u'\u4e00', u'\u4e9b', u'\u4e2d', u'\u6587']`
However, I expect it to be
[u'这', u'是', u'一', u'些', u'中', u'文']
Unless I double click this variable, it does not show the characters directly.
How can I solve this problem?
I have set Hexa character Hex(12) in program output for page break to a old printer alignment. When open the output text file with Notepad, the Hex'oc' will show as small male symbol (with small circal and a plus sign bottom). But some Notepad show as small square box for the same page break symbol.
The printing alignment is OK when using Notepad with small male symbol. However the printing alignment is not OK when using Notepad with small square box symbol.
BTW, I am using MS Window XP Pro version 2002 service pack 3.
Can anyboby help me on this ??
Thanks.
You mean this ♀ "female sign"?
The may be editors which switch to unicode whn discovering such symbols. Then your printer might get different data.
Another reason is the type of printer and driver:
There are drivers which just send what dots have to be drawn on the paper, others just send the text an dthe printer does it itself.
You wrote Notepad twice, do you mean the same native windows program?
What versions does it have?
If I go on "Help" > "About" it is printed: Version 6.1.7601
I have an MFC application compiled with MBCS set.
I have created a unicode list box on a regular MBCS dialog using the following code:
DWORD dwStyle = WS_CHILD|WS_VISIBLE|WS_VSCROLL;
hLangListBox = CreateWindowExW(WS_EX_CLIENTEDGE, //extended styles
_T(L"listbox"), //control 'class' name
L"Language", //control caption
dwStyle, //control style
10, //position: left
10, //position: top
200, //width
100, //height
GetSafeHwnd(), //parent window handle
//control's ID
reinterpret_cast<HMENU>(static_cast<INT_PTR>(ID_LANGUAGE_ENGLISH+20)),
AfxGetInstanceHandle(), //application instance
0);
When I inspect this dialog using Spy++ I see my Window Proc: has (Unicode) so I believe it is being created correctly.
I am populating the listbox with one of the following commands depending on if I have the data in a unicode string or a regular string
CStringW m_LanguageNames[MAX_LANG];
CString sFilename;
....
::SendMessageW(hLangListBox,LB_INSERTSTRING ,nMenuPos,reinterpret_cast<LPARAM>(theApp.m_LanguageNames[i].GetBuffer()));
::SendMessage(hLangListBox,LB_INSERTSTRING ,nMenuPos,reinterpret_cast<LPARAM>(sFileName.GetBuffer()));
Things look ok for most entries,
I can see
Chinese: 中文(简体)
French: Française
Japanese: 日本
but Russian looks like a P followed by a bunch of bars (P||||||), not Pусский. When I look at the contents of the CStringW in Visual Studio I do see the correct text.
Why can I see the other languages correctly and not russian? I am running on Windows 7 ultimate and compiling with Visual Studio 10
Edit
If I change my system locale to Russian I can see the russian characters fine. However, the ç in Française does not appear correct.
I thought unicode strings were independent of the system locale. Is that correct?
To populate my unicode CStringW I am doing:
CA2W tmp_wide(po.msgstr,CodePage);
m_LanguageNames[i] = tmp_wide;
where po.msgstr is a CString that was read in from a file. In this case, CodePage is set to 1251
If I inspect the variables in Visual Studio it appears that the conversion is happening correctly.
It appears that my unicode list box can display unicode characters from a MBCS such as Chinese fine, but that it can't display unicode characters from a SBCS that is different from my current code page.
Same problem, solved after a long time.
In my case the default font of dialog is set to "MS Sans Serif", just change to use the more recent font "Microsoft Sans Serif" and everything is resolved!
I have not solved this yet, but I think it is likely this is a font issue. I'm not going any farther with this, but the next step would be to have an owner drawn list box and specify an appropriate font for each language