"You can just ignore this warning, or fix this warning by enable the gb2312 encoding on your server.",
"For enable the gb2312 encoding, you can run commands:",
"",
" yum install -y mono-locale-extras",
""
}.JoinBy(ASCII.LF) _
.Warning
EndIf
EndSub
Constgb2312_not_enable$="It seems that your Linux server didn't enable the gbk2312 text encoding, sciBASIC# will using the default utf8 encoding mapping to the gb2312 encoding."
''' <summary>
''' 在linux上面如果没有安装gb2312的话,会出错,则这个函数会默认使用UTF8编码
''' 并给出警告信息
''' </summary>
''' <returns></returns>
''' <remarks>
''' If the linux server didn't enable the gb2312 text encoding, then this exception happends...
'''
''' ```bash
''' [ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: [Path] /home/software/cytonetwork.test/cytonetwork ---> System.Exception: [DIR] /home/software/cytonetwork.test ---> System.TypeInitializationException: The type initializer for 'Microsoft.VisualBasic.Text.TextEncodings' threw an exception. ---> System.NotSupportedException: Encoding 936 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
''' at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] In <902ab9e386384bec9c07fa19aa938869>:0
''' at System.Text.Encoding.GetEncoding (System.String name) [0x00012] In <902ab9e386384bec9c07fa19aa938869>:0
''' at Microsoft.VisualBasic.Text.TextEncodings..cctor () [0x00030] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' --- End of inner exception stack trace ---
''' at Microsoft.VisualBasic.TextDoc.SaveTo (System.String text, System.String path, System.Text.Encoding encoding, System.Boolean append, System.Boolean throwEx) [0x00063] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' --- End of inner exception stack trace ---
''' --- End of inner exception stack trace ---
''' at Microsoft.VisualBasic.TextDoc.SaveTo (System.String text, System.String path, System.Text.Encoding encoding, System.Boolean append, System.Boolean throwEx) [0x000a7] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' at Microsoft.VisualBasic.Language.UnixBash.LinuxRunHelper.BashShell () [0x0001b] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' at Microsoft.VisualBasic.CommandLine.Interpreter.__methodInvoke (System.String commandName, System.Object[] argvs, System.String[] help_argvs) [0x001c9] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' at Microsoft.VisualBasic.CommandLine.Interpreter.Execute (Microsoft.VisualBasic.CommandLine.CommandLine args) [0x00024] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' at Microsoft.VisualBasic.App.RunCLI (System.Type Interpreter, Microsoft.VisualBasic.CommandLine.CommandLine args, System.String caller) [0x00012] In <00ade39f7ffc4ab69ceb325aefc4ee1b>:0
''' at cytonetwork.Program.Main () [0x0000f] In <0Fa3aca1569b43dc8ca208295f3a029d>:0
''' ```
''' </remarks>
PrivateFunction__gbk2312_encoding()AsEncoding
Try
ReturnEncoding.GetEncoding("GB2312")
CatchexAsException
CallApp.LogException(ex)
IfNotApp.IsMicrosoftPlatformThen
Callgb2312_not_enable.Warning
EndIf
ReturnEncoding.UTF8
EndTry
EndFunction
''' <summary>
''' Get text file save <see cref="Encoding"/> instance