Skip to content

Unity2022.3.62f1报错:”String conversion error: Illegal byte sequence encounted in the input“ #1203

@KinJin-Ristina

Description

@KinJin-Ristina

项目从Unity2019升级到Unity2022有上述报错。相关的堆栈日志:

LUA: c# exception in print:System.ArgumentException: Illegal byte sequence encounted in the input.
Parameter name: string
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi(intptr,int)
at XLua.LuaDLL.Lua.lua_tostring (System.IntPtr L, System.Int32 index) [0x0001b] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\LuaDLL.cs:302
at XLua.StaticLuaCallbacks.PrintInternal (System.IntPtr L, System.String& s, System.String& stackTraceback) [0x00076] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\StaticLuaCallbacks.cs:915
at XLua.StaticLuaCallbacks.Print (System.IntPtr L) [0x0000d] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\StaticLuaCallbacks.cs:839
stack traceback:
[C]: in function 'print'

  1. 相关问题:Chinese characters cause "String conversion error: Illegal byte sequence encounted in the input." mono/mono#7117
  2. 修复方式参考:关于Unity的杂七杂八的问题(不定期更新) Lunatic-Works/Nova#6

目前修复方式如下:添加UNITY_2022_1_OR_NEWER的宏定义,可以解决该报错。但是还是期望官方大大可以给出更完美的修复方式~感谢!
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions