ansi

Adding colors to terminal prompt results in large white space

霸气de小男生 提交于 2019-12-05 01:34:45
问题 I'm working on a simple cli script and wanted to add some color to the following code: rl.question('Enter destination path: ', function(answer) { // ... }); rl.write('/home/' + user + '/bin'); Which displays in the terminal: Enter destination path: /home/jmcateer/bin_ But I wanted to add some color to the prompt I did the following: rl.question('\u001b[1;36mEnter destination path:\u001b[0m ', function(answer) { }); rl.write('/home/' + user + '/bin'); And the command line prompt ended up

gSoap generated client-side structure initialization and use

我的未来我决定 提交于 2019-12-04 20:29:12
gSoap generated client-side structure initialization and use (using ANSI C bindings) First of all, I searched and although there are a number of struct initialization solutions offered, I did not find anything directly answering this issue. Also, this question is being posted simply to assist anyone else that has a similar question, as I have already worked out the solution and because of my newbie status will post it immediately at least 8 hours after posting this. However, I am still very interested in comments and edits to the solution I will offer from those with better solutions, or with

在Redmine中查看txt文档出现乱码的解决方法

醉酒当歌 提交于 2019-12-04 20:19:51
在使用Redmine的过程中发现,查看txt的附件时中文显示为乱码,但是将该附件下载后打开显示正常。 问题原因如下: 我们在操作系统创建的txt文本文档默认的是ansi编码格式,而在整个Redmine中采用的都是UTF-8编码格式,所以上传后在Redmine中直接查看会显示乱码。 解决方法: 1.把txt附件下载下来查看 2.上传utf-8编码格式的txt附件 3.修改源代码。 修改Redmine安装目录下 app\controllers\attachments_controller.rb文件 在下面这行代码后面 @content = File.new(@attachment.diskfile, "rb").read 增加 @content = Iconv.new("utf-8","gb2312").iconv(@content) 保存文件,重启Redmine服务 来源: oschina 链接: https://my.oschina.net/u/1030976/blog/129510

Characters with ASCII > 128 are not correctly read in Javascript

有些话、适合烂在心里 提交于 2019-12-04 09:03:57
I have a HTML that includes a Javascript file. This script contains a special character, ASCII 152. When I try to display the charCodeAt, I get different results, but never the right one. Could you please advice? Thanks TEST.HTML <script type="text/javascript" charset=SEE BELOW src="test.js"> </script> TEST.JS file with ANSI encoding function d(a) { a=(a+"").split(""); alert(a[1].charCodeAt(0)); }; d("i˜g"); // Note that ˜ is 152 in ASCII TEST.HTML with x-user-defined charset: alert shows 63384. With %63232 works, as every char >128 is displayed as 63232+char. TEST.HTML with utf-8 charset:

C11 Standard docs

时光总嘲笑我的痴心妄想 提交于 2019-12-04 08:16:57
问题 Starting from this SO protected question I'm trying to understand what the difference between those documents: 9899 2012 costs $60 9899 2011 costs $265 As you can see those documents have very different prices and I don't know if the cheaper one is valid or is something like draft or cut copy of the real standard. Did someone buy the INCITS one? EDIT As @Chqrlie pointed out: What is the difference between the ANSI and ISO official documents available for a free and the final draft freely

emacs shell command output not showing ANSI colors but the code

淺唱寂寞╮ 提交于 2019-12-04 06:12:28
When I do M-! in my emacs 21.4 the ANSI codes gets literal. Eg: ls --color ^[[0m^[[0m05420273.pdf^[[0m ^[[0m100829_Baño1.pdf^[[0m Is there a way of having it with color and UTF8? The same question has been answered in SO before but with not totally satisfactory results (the solution given was to open a shell-mode). I know how to have colors in a shell. I only want to know how I can have color with M! (shell-command) or if it is not possible at all. A shell mode is too intrusive when you want only to show something quick and don't want to move to this buffer and you would like to have it

ANSI C: standard definition for the size of the __DATE__ and __TIME__ strings?

好久不见. 提交于 2019-12-04 04:58:21
问题 Is there a standard definition for the size of the __DATE__ and __TIME__ strings in ANSI C? The motivation behind this question is: I have two applications running on two different CPUs. During runtime, app #1 receives date and time (as part of version-info) from app #2. Of course, app #2 takes them from the preprocessor __DATE__ and __TIME__ definitions. So I would like to know whether or not I can statically allocate in app #1 an array, into which I can copy the info received from app #2.

Non-ASCII characters in C

限于喜欢 提交于 2019-12-04 03:24:28
问题 I was looking at google go's runtime source code (at https://go.googlecode.com/hg/src/pkg/runtime/ ), and it seems they use a special character for their function names, · . (Look for example at https://go.googlecode.com/hg/src/pkg/runtime/cgocall.c ). Is this accepted across major compilers? It's not ANSI C, is it? Or is it just some macro magic? Thank you! 回答1: C90 doesn't allow additional character in identifier (over those in the basic characters set), C99 do (both with the universal

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

筅森魡賤 提交于 2019-12-04 00:40:16
问题 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. 回答1: 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

ANSI C - Clearing a string

大兔子大兔子 提交于 2019-12-03 21:15:58
I've got a string declared like this: str=malloc(sizeof(char)*128); I want to clear it completely so that whenI do strncat() operation, the new characters will be written to the beginning of str . The reason I need to clear it is that I'm writing over it with a simplified version of itself (deleting excess whitespace). I suggest you simply do this: *str = '\0'; You don't need to clear the entire contents of the buffer. You can just set the first char to zero and then you have the empty string. Use memset : memset(str, 0, sizeof(char)*128); Regardless of this, if you are writing the string over