trStr
is a lightweight but powerful Python utility that solves the long-standing issue of incorrect string casing for Turkish characters — especially the problematic conversions between “i” ↔ “İ” and “I” ↔ “ı”.
Python's built-in string methods like .upper()
, .lower()
, .title()
, and .capitalize()
are designed with the English alphabet in mind. This creates serious issues when dealing with Turkish text, especially the letters “i” and “I”, which have unique uppercase/lowercase mappings in Turkish:
"aliler bize geldi".upper()
Output: 'ALILER BIZE GELDI' ❌
Expected: 'ALİLER BİZE GELDİ' ✅
Another example:
"Ispanak".lower()
Output: 'ispanak' ❌
Expected: 'ıspanak' ✅
These small mismatches can break user interfaces, search features, sorting logic, and more — especially in applications that rely on proper Turkish linguistic rules.
trStr
trStr
is a custom string class that wraps your original string and overrides Python's core casing methods to apply Turkish-aware transformations.
With trStr
, you can safely perform:
.lower()
→ converts I
to ı
, and keeps i
as i
.upper()
→ converts i
to İ
, and ı
to I
.capitalize()
→ capitalizes first character in a Turkish-correct way.title()
→ capitalizes each word with proper i/İ
handlingYou can install the package via PyPI:
pip install trstr
In many Turkish-language applications — including forms, user names, emails, location data, and UI text — a small mistake in casing leads to:
"Ali"
≠ "ALİ"
)With trStr
, you can stop writing casing workarounds and let the package handle it safely and correctly.
This project is licensed under the MIT License — free to use, modify, and redistribute.