Hi,
I've been trying to solve this problem for days, and I think I've finally
found it.

The Root Cause: The issue is triggered by the system's locale settings,
specifically LC_ALL or LC_CTYPE being set to certain non-English locales
(in my case, tr_TR.UTF-8).
Emacs's bidirectional (BIDI) text engine and the Org-mode HTML exporter
(ox-html.el) interact with the system's locale for string processing. In
certain locales, the internal logic that determines text directionality or
performs case-folding fails to correctly parse the #+TITLE keyword or its
value. Consequently, the exporter defaults to inserting a "neutral"
direction marker (‎ or U+200E) into the HTML metadata.

This behavior is likely not exclusive to Turkish; it may affect any locale
where standard ASCII-based string assumptions are overridden by local
linguistic rules (such as the "Turkish I" problem or specific RTL/LTR
boundary detections).


The Solution: The most effective fix is to ensure the Emacs process runs
under a standard C or en_US.UTF-8 locale for its internal environment,
which prevents the BIDI engine from incorrectly injecting direction markers
into the HTML head.

You can resolve this by launching Emacs with the following environment
variable: LC_ALL=C emacs

Or by adding the following to your init.el to ensure the internal
environment remains consistent regardless of how Emacs is launched:


Code snippet

(setenv "LC_ALL" "C")
(set-locale-environment "en_US.UTF-8")

Regards.

On Fri, Mar 6, 2026, 23:57 İsmail YEŞİLYURT <[email protected]> wrote:

> Hello,
>
> I am reporting a bug in the core export engine of Org 10.0-pre where the
> `#+TITLE` directive is parsed correctly but subsequently dropped by
> `org-export-get-environment`. This causes export backends (such as HTML) to
> generate an empty `<title>&lrm;</title>` tag and completely omit the
> document title from the output.
>
> Steps to reproduce:
> 1. Start Emacs without configurations: `emacs -Q`
> 2. Create a file named `test.org` with the exact following content:
>
> #+TITLE: TEST FILE
>
> * header
> lorem ipsum dolor sit amet
>
> 3. Parse the buffer using `M-: (org-element-parse-buffer)`. The AST
> correctly identifies the title:
> (keyword (:standard-properties [...] :key "TITLE" :value "TEST FILE"))
>
> 4. Evaluate the export environment: `M-: (plist-get
> (org-export-get-environment) :title)`
>
> Expected result:
> The evaluation should return the parsed title list, e.g., `("TEST FILE")`.
>
> Actual result:
> The evaluation returns `nil`. The core framework fails to pass the title
> to the export environment.
>
> I would appreciate your feedback on this regression in the export
> framework.
>
> Regards,
> Kaan I. Yesilyurt
>
> On Fri, Mar 6, 2026 at 1:22 PM İsmail YEŞİLYURT <[email protected]>
> wrote:
>
>> Hello,
>>
>> I am experiencing an issue where the Org-mode HTML exporter fails to
>> recognize the `#+TITLE` directive.
>> This results in an empty title tag (`<title>&lrm;</title>`) in the HTML
>> `<head>`.
>>
>> Steps to reproduce:
>> 1. Start Emacs without configurations: `emacs -Q`
>> 2. Create a new file named `test.org` with the exact following content:
>>
>> #+TITLE: test file
>>
>> * header
>> lorem ipsum dolor sit amet
>>
>> 3. Export the file to HTML using `C-c C-e h h`.
>>
>> Expected result:
>> The generated HTML should contain `<title>test file</title>` in the
>> header.
>>
>> Actual result:
>> The title tag evaluates to `<title>&lrm;</title>` and the title header is
>> entirely missing from the HTML body:
>> <?xml version="1.0" encoding="utf-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> <html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
>> <head>
>> <!-- 2026-03-06 Fri 13:09 -->
>> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
>> <meta name="viewport" content="width=device-width, initial-scale=1" />
>> <title>&lrm;</title>
>> <meta name="author" content="freeman" />
>> <meta name="generator" content="Org Mode" />
>> <style type="text/css">.......
>>
>> System Information:
>> - Emacs version: GNU Emacs 30.1 (built from source) [GNU Emacs 30.1
>> (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
>> of 2026-03-05]
>> - Org-mode version: 10.0-pre (cloned and built from savannah.nongnu.org)
>> as well as the default built-in version.
>> [Org mode version 10.0-pre (release_9.8-53-g1025e3 @
>> /home/freeman/BACKUP/emacs/org-mode/lisp/)]
>> - Operating System: Linux Mint [Linux blackmesa 6.17.0-14-generic
>> #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64
>> x86_64 x86_64 GNU/Linux]
>>
>> I have verified that the directive is on the first line and there are no
>> leading spaces, tabs, or hidden BOM characters before the `#+TITLE`
>> directive.
>>
>> I would appreciate any guidance on whether this is a known parsing issue
>> or if further debugging steps are required.
>>
>> Regards,
>> Kaan I. YESILYURT
>>
>

Reply via email to