In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Question:
When the code (.m) file written in matlab under Windows is copied to Linux (Ubuntu), the annotated Chinese is all garbled, and vice versa, it is the same problem.
Reason:
GB2312 encoding is used by default under Windows, and UTF-8 is used by default in Linux. So the code generated under Windows is GB2312 coding, which is of course recognized as garbled under Linux; on the contrary, the same garbled code.
Solution:
Transcode the file encoding format directly.
Use the iconv command under linux to change the encoding of the file:
Test1.m is converted from GB2312 to UTF-8 (the code of matlab under windows runs under linux)
Iconv-f GB2312-t UTF-8 test1.m-o test1.m
Test2.m is converted from UTF-8 to GB2312 (the code of matlab under linux runs under windows)
Iconv-f UTF-8-t GB2312 test2.m-o test2.m
If there are too many files, to batch, you can use the shell script written below to convert the code in batches.
How to use: put the script in the folder that needs to be converted, execute the script, and convert all files in the current directory and its subdirectories to the specified encoding method.
Perform as follows:
Convert from GB2312 to UTF-8
. / convertMatlab.sh win
Convert from UTF-8 to GB2312
. / convertMatlab.sh linux
Tip: ordinary users do not have execution permissions, so they need to increase execution permissions with chmod + x convertMatlab.sh.
Extend:
1.Linux operating system
Linux is a free-to-use and free-spread Unix-like operating system. It is a multi-user, multi-task, multi-threaded and multi-CPU operating system based on POSIX and UNIX.
It runs major UNIX tools, applications, and network protocols. It supports 32 bit and 64 bit hardware. Linux inherits the design idea of Unix with network as the core, and is a multi-user network operating system with stable performance.
2.Windows operating system
Microsoft Windows operating system is a set of operating system developed by Microsoft in the United States. it was born in 1985 and was only a Microsoft-DOS simulation environment at first.
Due to the continuous updates and upgrades of Microsoft, the subsequent version of the system is not only easy to use, but also gradually become the favorite operating system for every household.
3. The difference between the two
(1)。 The cost of use is different.
Linux is an open source project, so it is available to programmers for free.
And Windows is a system that needs to be purchased, and the latest genuine Windows system costs 888 yuan.
(2)。 Suitable for different objects
Linux is suitable for enterprise server system architecture, while Windows is suitable for public use.
(3)。 Different operation styles
Windows is popular-oriented, so the operation is more in line with the operating habits of ordinary people, mostly through the interface operation.
In many cases, Linux needs to be operated through the command line.
(4)。 Different supported softwar
Due to the large number of users of Windows, the software that supports Windows has advantages over Linux in terms of quantity and quality.
The Linux platform is only maintained by developers and lacks a lot of financial support, so there is a lack of quantity and quality of software.
(5)。 Different file formats
The kernel of the Windows operating system is NT, while Linux is shell.
(6)。 Security is different.
Windows systems are often targeted by hackers and viruses, so it is necessary to install some security protection software to protect the security of the computer.
Linux is much safer than Windows, and there is no need to install additional security software to use Linux.
(7)。 Customizability is different
Most of the operating scope of Windows has been limited by Microsoft, so basically it is how the system is set up, users can only operate according to the rules.
On the other hand, Linux provides higher customization, which allows developers to define their own operating system by coding.
(8)。 Program portability is different
The portability of Windows program is poor, and the program is basically incompatible with Linux.
The Linux program has good portability, not only between different Linux, but also to Windows.
These are the details of garbled files written in running windows in linux, please pay attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.