Skip to main content

[MiniProject] Convert Vietnamese unicode strings to unaccented strings

 Recently, I embarked on an exciting Arduino project where I needed to convert Vietnamese Unicode strings into their unaccented equivalents. The goal was simple, but I quickly ran into a problem: the conversion process wasn’t working as expected. Characters like "Độc lập tự do" were returning as a string of question marks!

I reached out for help and discovered that the issue was rooted in the way UTF-8 encoding was handled in my code. With some guidance, I learned how to properly decode UTF-8 characters into their Unicode equivalents before converting them. By breaking down the string into manageable arrays and thoroughly testing each case, I finally got the correct output: "Doc lap tu do."

This project taught me the importance of understanding encoding and the value of community support in problem-solving. Now, my Arduino project runs smoothly, converting Vietnamese text as intended!


The serial Monitor output:


Unicode & Vietnamese Legacy Character Encodings
https://vietunicode.sourceforge.net/charset/



Quick very logical code from ChatGPT
https://www.tutorialspoint.com/compile_c_online.php

Link source code

Note:
This project comes easy if you have already had some experience with Arduino, LCD 16x2 shield,  C/C++ programming, Unicode encoding, testing techniques, and AI literacy. If you don't know those things, don't be afraid, just google it or contact me. I am happy to help you with one week's feedback.


Comments

Popular posts from this blog

How to test frame buffer in linux

The intended goal of this article is to provide the user with enough information so they can display an image onto a screen of their choosing. How to re-build frame buffer testing application. Base knowledge http://trac.gateworks.com/wiki/OpenEmbedded/Video_Out Frame buffer test application - rebuild fb-test-app step 1: Download soure code ( git installed on your machine and account in git-hub is required) https://github.com/prpplague/fb-test-app Command in git: git init git clone https://github.com/prpplague/fb-test-app.git step 2: Change makefile vi Makefile //open Makefile by vim editor :set nu //show line number replace from line 6 to line 12 by folow code: CC=arm-linux-gnueabi-gcc CFLAGS=-02 -Wall Save change command :wq step 3: Rebuid Type “make” command step 4: Copy execute file to target system by filezilla or something like that step 5: Remote target by root account, change mode of execute file (what copied from host)

[Git] Handle trailing space when patching with git

After complete coding one module in development branch. Next phase is merging. Obviously, you can merge source code automatically without no errors happen. However, life is not dream. Create a patch git diff HEAD > newTariff.patch Apply patch git apply newTariff.patch then problem happens Problem git apply newTariff.patch:106: trailing whitespace. patch does not apply Route cause: Nguyên nhân: Do trong source code có những dấu space thừa (ô vuông màu đỏ hình dưới) Some whitespaces is existed in your patch. (red area in below pictures) Fix Clean white space and patch again. Cách khắc phục Xóa những dấu space này đi và thực hiện patch lại Make up after complete coding. Find and clean whitespace before create patch file. Sửa sau khi code xong Kiểm tra sau khi code xong có lỗi này không git diff HEAD --check Prevent whitespace by manually when typing source code Sửa ngay khi đang code =>Bật chức năng hiển thị các dấu whitespace, hoặc remove trailing

The best 12 AI Tools in 2023

The new life challenges require new tools.  For decades, AI technology has been a fuzzy field for unprofessional users. However, it is not rocket science anymore at this time.  There are the best 12 AI tools in 2023 that will keep you up and take some advantages in your business. Here, I put everything on your table. Enjoy Solves anything - ChatGPT ( https://chat.openai.com/auth/login ) Write anything - Writesonic ( https://writesonic.com/ ) Generates Art - Midjourney ( https://www.midjourney.com/explore ) Generates Code - Replit ( https://replit.com /) Generates Video - Synthesia ( https://www.synthesia.io/ ) Generates Music - Soundraw ( https://soundraw.io/ ) Generates Tiktoks - Fliki ( https://fliki.ai/ ) Generates Avatars - Starrytars ( https://starryai.com/en/starrytars ) Generates PPTs - SlidesAI ( https://www.slidesai.io/ ) Edit Pictures - Remini ( https://remini.ai/ ) Edit Video - Pictory ( https://pictory.ai/ ) Summarize Notes - Wordtune( https://www.wordtune.com /)