codepages

How to determine the currently active code page from a Java console application on Windows?

自闭症网瘾萝莉.ら 提交于 2019-12-13 10:23:31
问题 This is a simple Java application which displays the default code page on Windows: package doscommand; import java.io.IOException; import java.io.InputStream; public class DosCommand { public static void main(String[] args) throws IOException { InputStream in = Runtime.getRuntime().exec("chcp.com").getInputStream(); int ch; StringBuilder chcpResponse = new StringBuilder(); while ((ch = in.read()) != -1) { chcpResponse.append((char) ch); } System.out.println(chcpResponse); // For example:

Converting Code pages in c++

╄→尐↘猪︶ㄣ 提交于 2019-12-13 09:09:38
问题 What is equivalent of the C# string conversion code (between code pages): public static string Convert(string s) { Encoding encoder = Encoding.GetEncoding(858); return Encoding.Default.GetString(encoder.GetBytes(s)); } in VC++ (not CLR), e.g. using WideCharToMultiByte/MultiByteToWideChar WinAPI functions? 回答1: Yes, MultiByteToWideChar() and WideCharToMultiByte() are the equivalent Win32 functions, for example: std::wstring Convert(const std::wstring &s) { if (s.empty()) return std::wstring();

DotNetZip zipping files with Arabic names

我怕爱的太早我们不能终老 提交于 2019-12-11 16:14:47
问题 When creating a zip file out of many Arabic named files, I have as prompted in DotNetZip's FAQ changed the code page to the following: Using zip As New ZipFile() zip.AddDirectoryByName("Files") zip.AlternateEncoding = Encoding.UTF8 zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always Dim row As Integer For row = 0 To ds.Tables("d").Rows.Count - 1 fileToDownload = Server.MapPath("~/.../Resources/Attachments/" + ds.Tables("d").Rows(row).Item(1).ToString) zip.AddFile(fileToDownload, "Files")

.Net unicode problem, vb6 legacy

守給你的承諾、 提交于 2019-12-11 15:34:10
问题 I have a decryption routine in VB6. I now want the same decryption in C#. The strings that need decryption are in unicode, so I use Encoding.Unicode.GetString to read the input in C#. The input now looks exactly the same as in VB6. The first few characters in the loop are decrypted ok! Then I encounter a difference... The program parses the character '˜' with a different index than in VB6. When debugging I see the following in VB and in .Net: VB6 ˜ = code 152 C# ˜ = code 732 Needless to say,

What encoding/code page is cmd.exe using when it is started?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 06:14:53
问题 A nearly identical question was asked before. A good explanation of code pages was given in the reply, but it did not answer the question in my mind: What controls the code page used when cmd.exe is started? On my system, it gets changed somehow. In the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage, there is an item OEMCP that is set to 437. This seems to be the CP used by cmd.exe (as shown by chcp) after a fresh reboot, but something changes it later and it

How do I perform an accent insensitive compare in SQL Server for 1250 codepage

北战南征 提交于 2019-12-11 04:37:57
问题 There are already sever question and solution on accent insensitive search on stackoverflow, but none of them work for codepage 1250 (Central European and Eastern European languages). How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server? LINQ Where Ignore Accentuation and Case Ignoring accents in SQL Server using LINQ to SQL Modify search to make it Accent Insensitive in SQL Server Questions about accent insensitivity in SQL Server (Latin1_General_CI_AS) The

Why doesn't explicit COLLATE override database collation?

南楼画角 提交于 2019-12-11 01:28:25
问题 I am on SQL Server 2008 R2 dev, server default collation is Cyrillic_General_CI_AS Executing in SSMS SELECT 'éÉâÂàÀëËçæà' COLLATE Latin1_General_CS_AS or SELECT 'éÉâÂàÀëËçæà' COLLATE Latin1_General_CI_AI outputs eEaAaAeEc?a on(in ocntext of/use dbName) of database with default collation Cyrillic_General_CI_AS éÉâÂàÀëËçæà on database with default collation Latin1_General_CI_AS Why? 回答1: Those character literals in your queries are first converted to varchar strings under whatever collation the

CodePage ID to CodePage name: GetEncoding equivalent in Delphi?

孤人 提交于 2019-12-10 16:32:24
问题 I'm looking for a Win32 equivalent of the .Net Encoding.GetEncoding Method to be used in Delphi7. What I would like to achieve is to convert a Codepage ID (ie.: 28592) to a Codepage name (iso-8859-2 in this case). I've found a Win32 function called GetCPInfoEx, but that returns a long CodePage name, and I need the short one, like the ones listed on this page: (see Name column) http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx Thank you! 回答1: Here is my look-up table with code,

csv file UTF-8 (with BOM) to ANSI / Windows-1251

限于喜欢 提交于 2019-12-10 12:30:57
问题 I'm looking to create a batch file / macro to remove the first line of an auto generated UTF-8 CSV and convert it to Windows code page 1251 ("ANSI"). I've been looking all over the internet and tried a lot of things, but just can't find one that works... Removing the first line is simple enough @echo off set "csv=test.csv" more +1 "%csv%" >"%csv%.new" move /y "%csv%.new" "export\%csv%" >nul after that I'm lost, Ive tried using the TYPE set from DOS cmd /a /c TYPE test.csv > ansi.csv and many

Character-encoding problem with string literal in source code

懵懂的女人 提交于 2019-12-10 11:34:24
问题 $logstring = Invoke-Command -ComputerName $filesServer -ScriptBlock { param( $logstring, $grp ) $Klassenbuchordner = "KB " + $grp.Gruppe $Gruppenordner = $grp.Gruppe $share = $grp.Gruppe $path = "D:\Gruppen\$Gruppenordner" if ((Test-Path D:\Dozenten\01_Klassenbücher\$Klassenbuchordner) -eq $true) {$logstring += "Verzeichnis für Klassenbücher existiert bereits"} else { mkdir D:\Dozenten\01_Klassenbücher\$Klassenbuchordner $logstring += "Klassenbuchordner wurde erstellt!" }} -ArgumentList