octave - 为什么 Octave 在我的文件中插入这个奇怪的字符?

标签 octave

我在 Octave 中创建了以下代码,但出现了一些奇怪的行为:

# Sou um lab feliz
# Jesus, nosso Senhor, te ama
S1 = single(1.0);
S2 = single(0.0);
k = 1;
while(true)
...

这对我来说看起来不错。但是当我运行代码时,我得到了这个:

  parse error near line 1 of file 
  /home/gabriel/Documentos/Tarefas/Universidade/MS211/lab01.m
  syntax error
  ~}# Sou um lab feliz
   ^

这些字符不在我的编辑器上。当我在 VS Code 中打开它时,它们实际上就在那里,我删除了它们,一切正常。但是当我使用 Octave 编辑器并保存文件时,每次都会发生同样的情况,即使在不同的文件中也会发生这种情况。为什么会发生这种情况?

最佳答案

我和一些 friend ,我们发现了问题。

出于某种我不知道的原因,Octave 配置为以 HZ-GB-2312 编码保存,我认为这就是为什么它保存了错误的文件,当转换为 UTF-8 时它开始正常工作,因为它会起作用。

关于octave - 为什么 Octave 在我的文件中插入这个奇怪的字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64017712/

相关文章:

java - 如何抑制 Octave io 包加载警告 : "OpenJDK 64-Bit Server VM warning: Archived . .. java.system.class.loader 属性

octave - 错误: tf' function belongs to the control package from Octave Forge which you have installed but not loaded

java - matplotlib imagesc 类似于 java

file - 在 Octave 中将矩阵写入文本文件的最快方法是什么?

octave - 作为字符串中指数的变量( Octave )

octave - 如何在 GNU Octave 中查看函数体

r - Octave/Matlab 中的scale() R 函数等效项

matrix - 从 GNU Octave 中的矩阵中删除一列

c++ - 使用带有 Octave 和 Visual Studio 2010 编译器的 mkoctfile 编译 .mex 或 .oct 文件

matlab - 如何结束 MATLAB/Octave 函数定义?