ansi

Saving a Linq to Xml file as ANSI instead of UTF-8 in C# (Ivy)

半城伤御伤魂 提交于 2019-12-01 04:20:21
问题 In C#, I need to create XML files for use with Ivy and NAnt, but am having difficulty in getting the right encoding in the output file. If I use XElement's .Save("C:\foo.xml"), I get the correct looking file, but Ivy and/or NAnt gets upset, as the file is actually saved using UTF-8 but I actually need to save it as ANSI in order to be able to use it. I have a bodge in place at present, which is to use .ToString() to get the text and then use a StreamWriter to write it to a file. Ideally, I'd

How can a text file be converted from ANSI to UTF-8 with Delphi 7?

拟墨画扇 提交于 2019-12-01 03:48:01
I written a program with Delphi 7 which searches *.srt files on a hard drive. This program lists the path and name of these files in a memo. Now I need convert these files from ANSI to UTF-8, but I haven't succeeded. mjn The Utf8Encode function takes a WideString string as parameter and returns a Utf-8 string. Sample: procedure ConvertANSIFileToUTF8File(AInputFileName, AOutputFileName: TFileName); var Strings: TStrings; begin Strings := TStringList.Create; try Strings.LoadFromFile(AInputFileName); Strings.Text := UTF8Encode(Strings.Text); Strings.SaveToFile(AOutputFileName); finally Strings

Is the first field of a C structure always guaranteed to be at offsetof 0?

馋奶兔 提交于 2019-12-01 02:33:07
Regarding the C programming language... Part of the question at C/C++ Structure offset states that "& does not always point at the first byte of the first field of the structure" But looking over the "ANSI Rationale" at http://www.lysator.liu.se/c/rat/c5.html it states "no hole may occur at the beginning" in section 3.5.2.1 Structure and union specifiers. So I'm not sure if the "Rationale" is definitive but it does seem to contradict that part of that highly visible question. So, which is it? Is the first field of a C structure always guaranteed to be at offsetof 0? struct A { int x; }; struct

How to remove ANSI control chars (VT100) from a Java String

天大地大妈咪最大 提交于 2019-11-30 22:26:24
I am working with automation and using Jsch to connect to remote boxes and automate some tasks. I am having problem parsing the command results because sometimes they come with ANSI Control chars . I've already saw this answer and this other one but it does not provide any library to do that. I don't want to reinvent the wheel, if there is any. And I don't feel confident with those answers. Right now, I am trying this, but I am not really sure it's complete enough. reply = reply.replaceAll("\\[..;..[m]|\\[.{0,2}[m]|\\(Page \\d+\\)|\u001B\\[[K]|\u001B|\u000F", ""); How to remove ANSI control

Is the first field of a C structure always guaranteed to be at offsetof 0?

点点圈 提交于 2019-11-30 22:05:06
问题 Regarding the C programming language... Part of the question at C/C++ Structure offset states that "& does not always point at the first byte of the first field of the structure" But looking over the "ANSI Rationale" at http://www.lysator.liu.se/c/rat/c5.html it states "no hole may occur at the beginning" in section 3.5.2.1 Structure and union specifiers. So I'm not sure if the "Rationale" is definitive but it does seem to contradict that part of that highly visible question. So, which is it?

LoadStringFromFile and StringChangeEx from Unicode Inno Setup (Ansi file)

风格不统一 提交于 2019-11-30 17:37:25
I'm trying to update one of my scripts to use the Unicode version of Inno Setup. Unfortunately I'm running into a problem where StringChangeEx is expecting to see a unicode String instead of the AnsiString that I need (mismatched type). Is there an alternate way to replace matching AnsiStrings from Unicode Inno Setup? I'm using WizardDirValue() to avoid having to type ExpandConstant('{app}\') all the time, in case anyone wonders why. var AnsiData: AnsiString; begin LoadStringFromFile(WizardDirValue() + '\legacyansi.conf', AnsiData) { Type mismatch, StringChangeEx expects String which is

LoadStringFromFile and StringChangeEx from Unicode Inno Setup (Ansi file)

跟風遠走 提交于 2019-11-30 16:42:45
问题 I'm trying to update one of my scripts to use the Unicode version of Inno Setup. Unfortunately I'm running into a problem where StringChangeEx is expecting to see a unicode String instead of the AnsiString that I need (mismatched type). Is there an alternate way to replace matching AnsiStrings from Unicode Inno Setup? I'm using WizardDirValue() to avoid having to type ExpandConstant('{app}\') all the time, in case anyone wonders why. var AnsiData: AnsiString; begin LoadStringFromFile

PHP Ansi to UTF-8

柔情痞子 提交于 2019-11-30 16:34:45
I'm trying to create a script in PHP for converting some files to UTF-8. I have a file in Greek, where Notepad++ indicates that it ahs "ANSI" encoding. When I upload it to the server, it detects it's encoding as UTF-8 (something wrinf i think). Then when I convert it's contents to UTF-8 with utf8_encode () and download the new file, the characters are messed up. I tried to remove the BOM with PHP and the result was the same. I tried to remove the BOM with PHP without converting the file to UTF-8 but the file remained in ANSI encoding, without messed up characters. How can I fix that? OZ_

C++ project type: unicode vs multi-byte; pros and cons

我与影子孤独终老i 提交于 2019-11-30 06:41:51
问题 I'm wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set. Are there pros to going Unicode straight from the start, implying all your strings will be in wide format? Are there performance issues / larger memory requirements because of a standard use of a larger character? Is there an advantage to this method? Do some processor architectures handle wide characters better? Are there any

PHP Ansi to UTF-8

自作多情 提交于 2019-11-29 23:54:30
问题 I'm trying to create a script in PHP for converting some files to UTF-8. I have a file in Greek, where Notepad++ indicates that it ahs "ANSI" encoding. When I upload it to the server, it detects it's encoding as UTF-8 (something wrinf i think). Then when I convert it's contents to UTF-8 with utf8_encode () and download the new file, the characters are messed up. I tried to remove the BOM with PHP and the result was the same. I tried to remove the BOM with PHP without converting the file to