### 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)

_THREAD_SAFE_METHOD_
	const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
	ERR_FAIL_COND_V(!sd, String());
	return sd->custom_punct;
}
void TextServerAdvanced::_shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) {
	ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
	ERR_FAIL_COND(!sd);
	MutexLock lock(sd->mutex);
	if (sd->parent != RID()) {
		full_copy(sd);
	}
	sd->bidi_override.clear();
	for (int i = 0; i < p_override.size(); i++) {
		if (p_override[i].get_type() == Variant::VECTOR3I) {
			const Vector3i &r = p_override[i];
			sd->bidi_override.push_back(r);
		} else if (p_override[i].get_type() == Variant::VECTOR2I) {
			const Vector2i &r = p_override[i];
			sd->bidi_override.push_back(Vector3i(r.x, r.y, DIRECTION_INHERITED));
		}
	}
	invalidate(sd, false);
}
void TextServerAdvanced::_shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) {