Skip to content

Character encoding problem with Serial Monitor #1405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
nbourre opened this issue Sep 6, 2022 · 1 comment
Closed
3 tasks done

Character encoding problem with Serial Monitor #1405

nbourre opened this issue Sep 6, 2022 · 1 comment
Assignees
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@nbourre
Copy link
Contributor

nbourre commented Sep 6, 2022

Describe the problem

When using serial printing accented characters or ASCII higher than 127, the serial monitor mostly shows a "�", but not always.

Arduino_IDE_VKSKSsA35p

To reproduce

Serial.print accented characters or ASCII with values higher than 127.

E.g.:

    Serial.print("Humidité: ");
    Serial.print(h);
    Serial.print(("%  Température: "));
    Serial.print(t);
    Serial.print(("° C "));
    Serial.print(("Humidex : "));
    Serial.print(humidex);
    Serial.println(("° C "));

Expected behavior

The serial monitor should show the characters in the right encoding or at least UTF-8.

Arduino IDE version

2.0.0-rc9.3

Operating system

Windows

Operating system version

11

Additional context

Full code example :

#include <DHT.h>

// Broche de données
#define DHTPIN 2

// Type de capteur pour la librairie
#define DHTTYPE DHT11  // DHT 11

// Déclaration de l'objet
DHT dht(DHTPIN, DHTTYPE);

long currentTime = 0;
long dhtPrevious = 0;
long dhtDelay = 1000;

void setup() {
  Serial.begin(9600);
  Serial.println(F("DHTxx test!"));

  dht.begin();  // Initialisation

  currentTime = millis();
}

void loop() {
  currentTime = millis();

  if (currentTime - dhtPrevious >= dhtDelay) {
    dhtPrevious = currentTime;

    float h = dht.readHumidity();
    float t = dht.readTemperature();
    float humidex = dht.computeHeatIndex(t, h, false);

    Serial.print("Humidité: ");
    Serial.print(h);
    Serial.print(("%  Température: "));
    Serial.print(t);
    Serial.print(("° C "));
    Serial.print(("Humidex : "));
    Serial.print(humidex);
    Serial.println(("° C "));
  }
}

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@nbourre nbourre added the type: imperfection Perceived defect in any part of project label Sep 6, 2022
@per1234 per1234 self-assigned this Sep 6, 2022
@per1234
Copy link
Contributor

per1234 commented Sep 6, 2022

Hi @nbourre. Thanks for taking the time to submit an issue.

I see we have another report about this at #589.

It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

If you end up with additional information to share, feel free to comment in the other thread.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
@per1234 per1234 added conclusion: duplicate Has already been submitted topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants