control-characters

Arrow keys turn into control characters in Telnet

落爺英雄遲暮 提交于 2019-12-02 14:34:27
问题 I'm in an Ubuntu terminal, and telnet to a server. Now whenever I type 'up', it turns into ^[[A. Other arrow keys also turn into control characters. Is there a way I can run telnet so it understands my arrow keys? This would be a huge help because I'd like to scroll up in my commands history. 回答1: It's not telnet that needs to understand the escape sequences your keys produce; it's whatever program you're typing them into at the remote end. Looks like your $TERM environment variable (on the

Arrow keys turn into control characters in Telnet

痴心易碎 提交于 2019-12-02 10:23:02
I'm in an Ubuntu terminal, and telnet to a server. Now whenever I type 'up', it turns into ^[[A. Other arrow keys also turn into control characters. Is there a way I can run telnet so it understands my arrow keys? This would be a huge help because I'd like to scroll up in my commands history. It's not telnet that needs to understand the escape sequences your keys produce; it's whatever program you're typing them into at the remote end. Looks like your $TERM environment variable (on the remote system) is not getting set correctly for the terminal you're running telnet in. It's been a while

Unexpected behavior with a string stored in a variable in PowerShell

走远了吗. 提交于 2019-12-01 13:31:40
I'm getting some odd behavior from Excel's Cells.Find() method: Variable I'm searching on: PS > $volumename vol_01 PS > $volumename.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object produces no results: PS > $sheet.Cells.Find($volumename).Row but if I manually copy and paste the value of that variable: PS > $volumename = "vol_01" PS > $volumename.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object Gets the value I am expecting: PS > $sheet.Cells.Find($volumename).Row 198 They appear to

Powershell: Find/Replace pattern of ASCII control characters

老子叫甜甜 提交于 2019-12-01 06:19:16
I'm trying to write a script to search the contents of a file, and when it comes across a grouping of ASCII control characters, to insert a CR/LF. The pattern of characters I would like to replace are [ETX][NUL][STX][ETX][SOH] $filenames = @(Get-Childitem "E:\VendorFiles\*") $CR = @("[char]3 [char]0 [char]2 [char]3 [char]1") foreach ($file in $filenames) {$outfile = "$file" + ".txt" Get-Content $file | Foreach-object { $_ -replace $CR,"`r`n" ` -replace [char]3,"|" ` -replace [char]1,"{" ` -replace "\\","\\" ` } | Set-Content -encoding "UTF8" $outfile} This expression: @("[char]3 [char]0 [char

Removing control characters from a UTF-8 string

﹥>﹥吖頭↗ 提交于 2019-12-01 03:13:42
I found this question but it removes all valid utf-8 characters also (returns me a blank string, while there are valid utf-8 characters plus control characters). As I read about utf-8 , there's not a specific range for control characters and each character set has its own control characters . How can I modify above solution to only remove control characters ? Centro I think the following code will work for you: public static string RemoveControlCharacters(string inString) { if (inString == null) return null; StringBuilder newString = new StringBuilder(); char ch; for (int i = 0; i < inString

Powershell: Find/Replace pattern of ASCII control characters

我只是一个虾纸丫 提交于 2019-12-01 03:07:48
问题 I'm trying to write a script to search the contents of a file, and when it comes across a grouping of ASCII control characters, to insert a CR/LF. The pattern of characters I would like to replace are [ETX][NUL][STX][ETX][SOH] $filenames = @(Get-Childitem "E:\VendorFiles\*") $CR = @("[char]3 [char]0 [char]2 [char]3 [char]1") foreach ($file in $filenames) {$outfile = "$file" + ".txt" Get-Content $file | Foreach-object { $_ -replace $CR,"`r`n" ` -replace [char]3,"|" ` -replace [char]1,"{" `

Why does this C program print weird characters in output?

╄→гoц情女王★ 提交于 2019-12-01 03:06:19
问题 I've the following program: #include <stdio.h> int main() { int ch; while( ch = getchar() != '\n') { printf("Read %c\n",ch); } return 0; } No matter what I enter I get: Read Why is this happening and what is that weird char that I see? Stackoverflow is not printing the weird char. You can see it here: http://ideone.com/EfZHr 回答1: You need to place parenthesis as: while( (ch = getchar()) != '\n') Precedence of != is greater than that of = while( ch = getchar() != '\n') is same as: while( ch =

Escaping control characters in Oracle XDB

不打扰是莪最后的温柔 提交于 2019-11-29 15:33:17
I'm completely new to Oracle's XDB, in particular using it to generate XML output from a database table, and am working on an application which is moving from 9i (Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production) to 11g (Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production). Here's a small test case which illustrates the problem I'm having: select xmlelement("test", test) from (select 'a' test from dual); This works and gives me: <test>a</test> However in 11g, if I swap 'a' for an invalid character, such as U+0013 I get the following error: ORA-31061: XDB

Differentiating text keycode from control keycode in Android KeyEvent

回眸只為那壹抹淺笑 提交于 2019-11-29 12:54:17
There are 284 KeyEvent key codes . Some of them represent Unicode characters (like KEYCODE_A and KEYCODE_1 ), while others represent control characters (like KEYCODE_DEL ). I am making a custom view that handles keyboard input . It gets most of its input from an Input Connection, but sometimes keyboards send key codes (normall associated with hard keyboard input). I need to handle that, too. Do I need to exhaustively handle every control key code and then convert the rest to text (with (char) event.getUnicodeChar() ) or is there a built in way to differentiate the text codes from the control

Get-Content and show control characters such as `r - visualize control characters in strings

醉酒当歌 提交于 2019-11-29 07:27:37
What flag can we pass to Get-Content to display control characters such as \r\n or \n ? What I am trying to do, is to determine whether the line endings of a file are in the Unix or Dos style. I have tried simply running Get-Content , which doesn't show any line ending. I have also tried using Vim with set list , which just shows the $ no matter what the line ending is. I would like to do this with PowerShell, because that would be mighty useful. One way is to use Get-Content's -Encoding parameter e.g.: Get-Content foo.txt -Encoding byte | % {"0x{0:X2}" -f $_} If you have the PowerShell