Skip to content

[web]: Unicode char throws Bad UTF-8 encoding (U+FFFD; REPLACEMENT CHARACTER) error #137025

Description

@d-polikhranidi

Is there an existing issue for this?

Steps to reproduce

I have searched that there were similar issues but they are closed without any fix. I suppose that error in Flutter debug console in Android Studio or something related with this. I suppose so because there's no any issues with rendering such special characters but only if there appears in console (you can see this in attached video)

Second, I think the problem is wrong conversion from special char (in my case ) to bytes ([239, 191, 189, 10] but it must be [239, 191, 189]).

There's no any problems in release mode or if I go to localhost from other browser instance which is not connected to Flutter debugger. But using other instance of browser is not a solution because it makes development very difficult in such circumstances))

To reproduce just start my example code

Expected results

Flutter debugger shows in console

Actual results

App crashes

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {

    const String crashString = "�";

    return MaterialApp(
      title: 'App crasher',
      home: Center(
        child: TextButton(onPressed: () => print(crashString), child: const Text("Crash app")),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
37484d2d-7302-406a-87f3-f8b81dbd843b.mp4

Logs

Logs
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:54270/2-5SauS8BYM=/ws
Debug service listening on ws://127.0.0.1:54270/2-5SauS8BYM=/ws
Debug service listening on ws://127.0.0.1:54270/2-5SauS8BYM=/ws
Finished with error: Bad UTF-8 encoding (U+FFFD; REPLACEMENT CHARACTER) found while decoding string: �
. The Flutter team would greatly appreciate if you could file a bug explaining exactly what you were doing when this happened:
https://github.com/flutter/flutter/issues/new/choose
The source bytes were:
[239, 191, 189, 10]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.8, on macOS 14.0 23A344 darwin-arm64, locale ru-BY)
    • Flutter version 3.13.8 on channel stable at /Users/admin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c4930c4ac (3 days ago), 2023-10-18 10:57:55 -0500
    • Engine revision 767d8c75e8
    • Dart version 3.1.4
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Users/admin/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/admin/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (3 available)
    • iPhone (mobile) • 00008030-00125C940292802E • ios            • iOS 17.0.3 21A360
    • macOS (desktop) • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)    • chrome                    • web-javascript • Google Chrome 118.0.5993.96

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolefound in release: 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: invalidIssue is closed as not validteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions