### Godot version

4.0.dev Beta 14

### System information

Windows 10 and Linux (Pop!_OS 22.04)

### Issue description

When opening a UTF-8 text file with an emoji or other unicode character, the line will not show up and the editor starts producing a number of errors in output. Here is the output:

--- GDScript language server started ---
  U_ILLEGAL_ARGUMENT_ERROR
  modules/text_server_adv/text_server_adv.cpp:4389 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:3837 - Condition "!sd" is true. Returning: TextServer::ORIENTATION_HORIZONTAL
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:3837 - Condition "!sd" is true. Returning: TextServer::ORIENTATION_HORIZONTAL
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:3837 - Condition "!sd" is true. Returning: TextServer::ORIENTATION_HORIZONTAL
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5829 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  U_ILLEGAL_ARGUMENT_ERROR
  modules/text_server_adv/text_server_adv.cpp:4389 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:3837 - Condition "!sd" is true. Returning: TextServer::ORIENTATION_HORIZONTAL
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:3837 - Condition "!sd" is true. Returning: TextServer::ORIENTATION_HORIZONTAL
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5730 - Condition "!sd" is true. Returning: nullptr
  modules/text_server_adv/text_server_adv.cpp:5741 - Condition "!sd" is true. Returning: 0
  modules/text_server_adv/text_server_adv.cpp:5818 - Condition "!sd" is true. Returning: 0.0
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5770 - Condition "!sd" is true. Returning: Vector2i()
  modules/text_server_adv/text_server_adv.cpp:5803 - Condition "!sd" is true. Returning: Size2()

### Steps to reproduce

Add a text file and paste in an emoji into the text resource file then open it in the editor.

### Minimal reproduction project

[FileIOGuide.zip](https://github.com/godotengine/godot/files/10477742/FileIOGuide.zip)

for (int i = 0; i < p_dict.size(); i++) {
		Char16String word = p_dict[i].utf16();
		int32_t len = uspoof_getSkeleton(sc, 0, word.get_data(), -1, NULL, 0, &status);
		skeletons.write[i] = (UChar *)memalloc(++len * sizeof(UChar));
		status = U_ZERO_ERROR;
		uspoof_getSkeleton(sc, 0, word.get_data(), -1, skeletons.write[i], len, &status);
	}
	int32_t len = uspoof_getSkeleton(sc, 0, utf16.get_data(), -1, NULL, 0, &status);
	UChar *skel = (UChar *)memalloc(++len * sizeof(UChar));
	status = U_ZERO_ERROR;
	uspoof_getSkeleton(sc, 0, utf16.get_data(), -1, skel, len, &status);
	for (int i = 0; i < skeletons.size(); i++) {
		if (u_strcmp(skel, skeletons[i]
			match_index = i;
			
		}
	}
	memfree(skel);
	for (int i = 0; i < skeletons.size(); i++) {
		memfree(skeletons.write[i]);
	}
	uspoof_close(sc);
	ERR_FAIL_COND_V_MSG(U_FAILURE(status), -1, u_errorName(status));
	return match_index;
}
bool TextServerAdvanced::_spoof_check(const String &p_string) const {
	UErrorCode status = U_ZERO_ERROR;
	Char16String utf16 = p_string.utf16();
	USet *allowed = uset_openEmpty();
	uset_addAll(allowed, uspoof_getRecommendedSet(&status));