The model’s Arabic answer is correct, but on screen the price sits on the wrong side and the model name is broken in half. That is a bidi problem, not a model problem.
How it works
Text is stored in logical order, the order it is read and typed. UAX #9, the Unicode Bidirectional Algorithm, assigns each character a direction type and works out display order for the line. Characters never move in memory; only their display changes.
Letters are strong: Arabic is right-to-left, Latin is left-to-right. Digits and punctuation are weak or neutral and take their position from the text around them. European digits are type EN and Arabic-Indic digits type AN, and UAX #9 resolves EN to AN after an Arabic letter.
A typical mixed string from an Arabic assistant:
جرّب النموذج broadnet/qwen3.8-27b على 20 رسالة
Displayed in a left-to-right context, the Arabic runs read right to left but the paragraph starts on the left, so the sentence appears in the wrong order and the slash, dots and the number 20 can attach to the wrong run. The fix is to set the base direction, not to reorder characters.
When markup is not available, Unicode has invisible control characters:
| Code point | Name | Use |
|---|---|---|
| U+200F | RLM, right-to-left mark | Nudge a neutral character to RTL |
| U+061C | ALM, Arabic letter mark | Same, for Arabic contexts |
| U+2067 | RLI, right-to-left isolate | Start an RTL span |
| U+2066 | LRI, left-to-right isolate | Start an LTR span, such as a model ID |
| U+2068 | FSI, first strong isolate | Take direction from the content |
| U+2069 | PDI, pop directional isolate | End any isolate |
UAX #9 encourages isolates over the older embeddings (U+202A to U+202C) in new documents, because embeddings affect surrounding text too strongly, and says overrides (U+202D, U+202E) should be avoided where possible because of security concerns.
Why it matters
In HTML, W3C advises putting dir="rtl" on the html element when the page is RTL, and not using CSS to set base direction. For text whose direction you do not know, such as a model reply or a user’s name, use dir="auto" or the bdi element. W3C notes auto decides from the first strong character, so a mostly English paragraph that starts with an Arabic word can still display wrongly.
For API users the usual problems are:
- Chat UIs. A streamed reply starts in English and turns Arabic. Set
dir="auto"on each message, not once on the page. - JSON and logs. Model output can contain invisible marks. A value like
"gulf"will not equal"gulf". Strip bidi controls before comparing structured output fields. - Translated UI strings. Placeholders and product names inside Arabic need isolates; see translating app strings to Arabic.
On BroadNet Inference
BroadNet’s chat endpoint returns Arabic as ordinary text in the JSON response, as any OpenAI-compatible API does, and BroadNet has no display or bidi feature. Direction is your front end’s job. If you also normalize text for search, remove bidi controls in the same pass as Unicode normalization, since NFC and NFKC keep them.
Common mistakes
- Reversing Arabic strings in code to “fix” display.
- Setting direction with CSS only.
- Leaving U+200F or U+2067 inside IDs, keys or enum values.