Do I need to escape echo'd strings for console output?
The shell interpretes commands from stdin but you are writing to stdout. So everything is fine
However, to prevent you from accidently copy pasting them into a terminal it is never a bad idea to escape them
Why is my byte array returned from fread smaller than the number of bytes in the file itself when it includes unicode special symbols?
The ₀
symbol is three bytes long with a UTF-8 encoding (0xE2 0x82 0x80
). And internal to MATLAB, it's actually two bytes due to a UTF-16 encoding (0x80 0x20
little-endian).
However, since a precision
of *char
was given to fread
, the returned data is returned as a char
array1. And to a char
array, regardless of the underlying encoding, ₀
is simply a single character when considering its size
:
If
A
is a character vector of typechar
, thensize
returns the row vector[1 M]
whereM
is the number of characters.
1 I'm assuming the strong assertion of matching matrix size from fread
if sizeA
is given (per the documentation) is only valid for numeric data since, as may be evident above, byte count and character count are not necessarily one-to-one.
Why does Git treat this text file as a binary file?
It simply means that when git inspects the actual content of the file (it doesn't know that any given extension is not a binary file - you can use the attributes file if you want to tell it explicitly - see the man pages).
Having inspected the file's contents it has seen stuff that isn't in basic ascii characters. Being UTF16 I expect that it will have 'funny' characters so it thinks it's binary.
There are ways of telling git if you have internationalisation (i18n) or extended character formats for the file. I'm not sufficiently up on the exact method for setting that - you may need to RT[Full]M ;-)
Edit: a quick search of SO found can-i-make-git-recognize-a-utf-16-file-as-text which should give you a few clues.
See NSUserDefaults file content
I'm able to open the file using "pico" but it shows weird characters.
Because as an optimization (storage space and read/write speed) iOS stores property list files in the binary format. You need to convert it to XML format using
plutil -convert xml1 com.yourapp.bundleid.plist
After this, you'll be able to see a meaningful result when opened in a text editor (such as Pico).
Linux Terminal: typing feedback gone, line breaks not displayed
Execute the command reset
and your terminal should be restored (reference).
This issue happens generally when dumping binary data to the terminal STDOUT
which when the escape codes received are processed can do anything from change the color of the text, disable echo, even change character set.
The easy way to avoid this is to ensure you do not dump unknown binary data to the terminal, and if you must then convert it to hexadecimal to ensure it doesn't change the terminal settings.
Convert ^M (Windows) line breaks to normal line breaks
This is the only thing that worked for me:
:e ++ff=dos
Found it at: http://vim.wikia.com/wiki/File_format
Related Topics
How to Add External References in Monodevelop
Host Multiple ASP.NET Core Web Application Under a Single Linux Server
How to Run a Bash Function() in a Remote Host? in Ubuntu
Behavior of Writing to Tcp Socket Before Reading All Data
Debian Sources.List.D Versus Sources.List
Run Hydra (Mpiexec) Locally Gives Strange Ssh Error
Bluetooth Over Uart Using Hciattach
Yocto for Nvidia Jetson Fails Because of Gcc 7 - Cannot Compute Suffix of Object Files
Which Tool Has Replaced Gatttool in Bluez5
Launching Sonar Scanner from a Gitlab Docker Runner
How to Cross-Compile a Autotools Project for Arm
Splitting a Large Directory into Smaller Ones in Linux
Bash Script Commands Not Working in Cron
What Is Difference Between Sched_Batch and Sched_Other Scheduling