From 82892bfe74cca60b877980d49b9c85eb80dee922 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sun, 7 Jun 2020 07:59:19 -0500 Subject: [PATCH] Mention that to_lowercase isn't perfect FIxes #2148 --- src/ch12-05-working-with-environment-variables.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ch12-05-working-with-environment-variables.md b/src/ch12-05-working-with-environment-variables.md index 1cdb8f799b..d6ac076ebc 100644 --- a/src/ch12-05-working-with-environment-variables.md +++ b/src/ch12-05-working-with-environment-variables.md @@ -60,7 +60,10 @@ function to lowercase the query and the line before comparing them First, we lowercase the `query` string and store it in a shadowed variable with the same name. Calling `to_lowercase` on the query is necessary so no matter whether the user’s query is `"rust"`, `"RUST"`, `"Rust"`, or `"rUsT"`, we’ll -treat the query as if it were `"rust"` and be insensitive to the case. +treat the query as if it were `"rust"` and be insensitive to the case. While +`to_lowercase` will handle basic Unicode, it won't be 100% accurate. If we were +writing a real application, we'd want to do a bit more work here, but this section +is about environment variables, not Unicode, so we'll leave it at that here. Note that `query` is now a `String` rather than a string slice, because calling `to_lowercase` creates new data rather than referencing existing data. Say the