how to read Arabic input from cmd? - cmd

I want to ask if can read entered query in Arabic in cmd when running the program written in python ( my program accept query from user in cmd, it accepts the English input but doesn't accept the Arabic input )?

To allow unicode character support in cmd you need to set the code page for the language you are after.
This is done with
chcp CodePageNumber
I think arabic should be chcp 708
See more info here: http://ss64.com/nt/chcp.html
And a list of code pages here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx

Related

Print Cyrillic characters in Genexus report PDF

I am printing a character variable in a pdf via the standard Genexus reporting procedure, but when I try to print Cyrillic characters, they are skipped or replaced by question marks. In the record these characters are saved correctly, it is only the printout on pdf that does not show them. Do I need to change anything in the pdfreport.ini file? Or are there other ways?
I solved setting in my language object (Italian in my case) the codepage as 1251 instead of 1252. In this way it should use windows-1251 encoding that include cyrillic characters. For some reason I had to set the printed variable to Microsoft Sans Serif too

how to get the scripts format

I am seeing this in my browse:
\xe18\xe23\xe23\xe21\xe0a\xe32\xe15
I believe it's some valid Thai scripts? But how do I know the format of it?
Thanks
It's hard to know if this is the correct answer without more details but the sample you provided looks like a hexadecimal escape sequence.
\x followed by two hexadecimal characters represent a character by its ASCII code
You can check directly wha the value is in your browser console:
console.log("\xe18\xe23\xe23\xe21\xe0a\xe32\xe15");
Output is:
á8â3â3â1àaã2á5

How to use Mac synthetic voice called from VBA code (through MacScript) to read non-Latin characters (Greek)

I'm facing a problem when trying to call AppleScript (MacScript) to read out aloud non-Latin characters from VBA on Mac Excel 2011 (e.g. text in specific Excel cells). The following code line is working fine to read French text using the synthetic voice "Audrey":
MacScript ("say """ & FrenchStrg & """ using ""Audrey""")
FrenchStrg e.g. "croissant"
However, when trying to use the same code for Greek using the synthetic voice "Nikos", as in
MacScript ("say """ & GreekStrg & """ using ""Nikos""")
GreekStrg e.g. "ούζο"
most of the string (in Greek characters) is interpreted as "_" and is therefore not read aloud (the command "say "ούζο" using "Nikos"" is working fine in the AppleScript editor). In some cases, a few letters may be interpreted as some special character and are read out accordingly, but I couldn't find a useful pattern.
When changing the standard language of Mac OsX from English to Greek, the characters are correctly recognized within the VBA editor and in a MsgBox. However, the output to MacScript is still not working. Does the VBA MacScript function only accept non-unicode text? Is there any solution?
Any help would be much appreciated!
Thank you #Zero for suggesting to use the clipboard. This did indeed solve the problem. Here is the final working code:
Cells(1, 1).Copy
MacScript ("say (the clipboard) using ""Nikos""")
This circumvents the problem of strings getting converted into non-unicode text.
I don't think this will work but to be sure you should try it anyway:
MacScript ("say """ & (GreekStrg as Unicode text) & """ using ""Nikos""")
Unicode Support AppleScript is now entirely Unicode-based.
Comments and text constants in scripts may contain any Unicode
characters, and all text processing is done in Unicode, so all
characters are preserved correctly regardless of the user’s language
preferences. For example, this script works correctly in AppleScript
2.0, where it would not have in previous versions:
set the Japanese_phrase to "日本語"
set the Russian_phrase to "Русский"
set the new_phrase to the Japanese_phrase & " and " & the Russian_phrase
return new_phrase

Using non-ASCII characters in a cmd batch file

I'm working on a .bat program, and the program is written in Finnish. The problem is that CMD doesn't know these "special" letters, such as Ä, Ö, Å.
Is there a way to make those work? I'd also like it if the user could use those letters too.
Part of my code:
#echo off
/u
title JustATestProgram
goto test123
:test123
echo Letters : Ää Öö Åå
pause
exit
When I open this file, the letters look like this:
Try putting this line at the top of the batch file:
chcp 65001
It should change the console encoding to UTF-8, and you should be able to read the file properly in the script after that.
Theoretically you just need to use the /u (Unicode) switch:
c:\>cmd /u
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
c:\>echo Ä
Ä
If you use Notepad++, you can simply change the charset. Doing this will allow you to write letters from desired charset. The western region -US. should support it.
You can do it in a drop down menu in Notepad++ or by hand by writing chcp 437. But I recommend doing this in Notepad++ as it will show you the output as it will be in the batch. So you will then easily see if you use the right code page. And at same time it's easy to switch if you want more special symbols. You can also as stated in previous posts. Try UTF-8.
You can read more about this here: http://ss64.com/nt/chcp.html. And here's a list over different code pages (check out the OEM pages): Code Page Identifiers
The command prompt uses DOS encoding. Windows uses ANSI or Unicode.
PS I'm assuming you are in the US with code page 437 rather than international English/Western European 850.
So I used Character Map to get the DOS code then find out what ANSI character that code maps to.
This is the notepad contents.
echo Ž„™”†
Which was made by putting the DOS codes for your characters into notepad.
0142, 0132, 0153, 0148, 0143, 0134 which display as the above ANSI characters.
Command prompt output
C:\Windows\system32>echo ÄäÖöÅå
ÄäÖöÅå
Alt + Character Code [Prev | Next | Contents]
Holding down alt and pressing the character code on the numeric keypad will enter that character. The keyboard language in use must support entering that character. If your keyboard supports it the code is shown on the right hand side of the status bar in Character Map else this section of the status bar is empty. The status bar us also empty for characters with well known keys, like the letters A to Z.
However there is two ways of entering codes. The point to remember here that the characters are the same for the first 127 codes. The difference is if the first number typed is a zero of not. If it is then the code will insert the character from the current character set else it will insert a character from the OEM character set. Codes over 255 enter the unicode character and are in decimal. Characters entered are converted to OEM for Dos applications and either ANSI or Unicode depending on the Windows' application. See Converting Between Decimal and Hexadecimal.
E.G., Alt + 0 then 6 then 5 then release Alt enters the letter A
From Shortcut Keys and Key Modifiers by Me at https://1drv.ms/f/s!AvqkaKIXzvDieQFjUcKneSZhDjw

Extended charsets chars not reccognized and converting to ? mark

I have a string contain some special char like "\u2012" i.e. FIGURE DASH. When i am trying to print this on console I am getting a '?' mark instead of its symbol. I have an editor where in I can insert the symbol using alt+numpad like alt+2012. In editor it I could see the symbol save it in a xml file and get the value using nodevalue, I get a '?' mark.
To summerize I am facing problem to read extended latin a charset. What i need is When i insert such symbols and read it, i should get something like &#xXXXX;.
Please help!
TIA :)
Simply I have a String inpath = "À";, I want to get its unicode value..like &#xXXXX;
The default console encoding in Windows is some MS-DOS code page and they don't support the character. You can try running chcp 65001 before running the program but you might also need to change the console font as well.
You don't need to do anything you wouldn't do with any other character, as long as you use UTF-8. You aren't doing that in many places. You need to explicitly write in your code to save and read the file in UTF-8, and not rely on the platform default encoding.

Resources