Home Operation and Maintenance Linux Operation and Maintenance Linux and windows files display garbled characters

Linux and windows files display garbled characters

Nov 06, 2019 am 09:44 AM
linux windows Garbled characters document

Linux and windows files display garbled characters

Question:

Copy the code (.m) file written in matlab under Windows to Linux (Ubuntu), and the comments are in Chinese It's all gibberish.

Reason:

The default encoding under Windows is GB2312, and the default encoding under Linux is UTF-8. Therefore, the code generated under Windows is GB2312 encoding, which is of course recognized as garbled code under Linux; conversely, the code is garbled in the same way.

Solution:

Use the iconv command under linux to change the encoding of the file:

test1.m is converted from GB2312 to UTF-8 (windows The code of matlab under linux 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

Recommended tutorial: linux tutorial

The above is the detailed content of Linux and windows files display garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fresh Guide: Fix Windows Printer Problems and Spooler Issues Fresh Guide: Fix Windows Printer Problems and Spooler Issues Aug 29, 2025 am 08:12 AM

IfyourWindowsprinterisn'tworking,trythesesteps:1.RestartthePrintSpoolerservice.2.Runthebuilt-inPrinterTroubleshooter.3.Reinstalltheprinterdriver.4.Manuallyclearstuckprintjobs.5.UseCommandPrompttoresetprintingcomponents.

What is a pass key? How to create it? OEE Exchange's pass key tutorial ((APP/Web) What is a pass key? How to create it? OEE Exchange's pass key tutorial ((APP/Web) Aug 29, 2025 pm 03:54 PM

What is Pass Key Pass Key is a new type of authentication technology that allows users to access their accounts without manually entering their password when logging into a website or application. Through the pass key, users can complete identity authentication using fingerprint recognition, facial scanning or device unlocking methods (such as PIN code). This technology is based on the encryption key pair mechanism, providing efficient and secure protection capabilities, and effectively resisting cyber threats such as phishing attacks. Advantages of Pass Key 1. Password-free login, which is more convenient to operate: use fingerprints, faces and other biometric methods to log in directly to the account, so as to save the hassle of repeatedly entering passwords and avoid login failures caused by entering the wrong password. 2. Stronger security: Pass keys follow technical standards formulated by the FIDO Alliance and W3C, and use asymmetric encryption algorithms to replace traditional secrets.

How to use virtual private networks (VPN) on Windows How to use virtual private networks (VPN) on Windows Aug 26, 2025 am 07:20 AM

TosetupanduseaVPNonWindows,firstopenSettings>Network&Internet>VPNandclickAddaVPNconnection;1.SetVPNprovidertoWindows(built-in);2.Enterarecognizableconnectionname;3.Inputtheservernameoraddressprovided;4.SelectthecorrectVPNtype(e.g.,IKEv2,L2T

How to turn off advertising ID in Windows How to turn off advertising ID in Windows Aug 27, 2025 am 06:03 AM

OpenSettingsviatheStartmenu,thengotoPrivacy&security(orPrivacyonWindows10).2.ClickGeneralintheleftmenuandlocatetheadvertisingIDoption.3.Toggleoff"LetappsuseadvertisingIDtomakeadsmoreinterestingtoyoubasedonyourappactivity"todisableit.Dis

'Windows can't find one of the files in this theme' [Fixed] 'Windows can't find one of the files in this theme' [Fixed] Aug 28, 2025 am 06:44 AM

First, confirm whether the theme file is complete. 1. Enter the corresponding theme folder of C:\Users\YourName\AppData\Local\Microsoft\Windows\Themes\; 2. Check whether the .theme file exists; 3. Confirm whether the referenced picture is in the Backgrounds subfolder; 4. Verify whether the referenced .msstyles file actually exists; if any file is missing, you need to download the theme package and install it correctly to solve the problem.

How to find the classic Control Panel items in Windows How to find the classic Control Panel items in Windows Aug 26, 2025 am 07:12 AM

TheclassicControlPanelinWindows10and11canbeaccessedviaStartmenusearch,Runcommand(control),FileExplorer,orright-clickingtheStartbutton.2.ControlPaneloffersthreeviews:Category,Largeicons,andSmallicons,withiconviewsbeingfastestforlocatingspecifictools.3

Fixed: Windows Is Showing 'Windows could not automatically detect this network's proxy settings' Fixed: Windows Is Showing 'Windows could not automatically detect this network's proxy settings' Aug 29, 2025 am 04:23 AM

DisableAutomaticProxyDetection(IfNotNeeded):Ifyou'reonahomeorsmallofficenetwork,disableautomaticproxydetectiontoresolvetheerror;pressWindows I→Network&Internet→Proxy,toggleAutomaticallydetectsettingstoOff,andensureUsesetupscriptisoffunlessaPACfil

How to Fix Windows 'We couldn't create a new partition or locate an existing one' Error How to Fix Windows 'We couldn't create a new partition or locate an existing one' Error Aug 29, 2025 am 09:03 AM

Ifyougetthe"couldn'tcreateanewpartition"errorduringWindowsinstallation,trythesesteps:1.UseDiskParttocleanandrepartitionthedrive.2.CheckBIOSSATAmode(switchbetweenIDE/AHCI).3.Loadproperstoragedriversduringsetup.4.ConvertdiskbetweenMBRandGPTto

See all articles