@@ -46,8 +46,12 @@ Idea came from puppet's hiera.
4646 - [ Vault] ( #vault )
4747 - [ Merge with Terraform remote state] ( #merge-with-terraform-remote-state )
4848 - [ Merge with env variables] ( #merge-with-env-variables )
49+ - [ Unicode Support] ( #unicode-support )
4950 - [ himl config merger] ( #himl-config-merger )
51+ - [ Output filtering] ( #output-filtering )
5052 - [ Extra merger features] ( #extra-merger-features )
53+ - [ Custom merge strategy] ( #custom-merge-strategy )
54+ - [ Development] ( #development )
5155
5256## Installation
5357
@@ -91,8 +95,13 @@ exclude_keys = () # can choose to remove specific keys
9195output_format = " yaml" # yaml/json
9296
9397
94- config_processor.process(path = path, filters = filters, exclude_keys = exclude_keys,
95- output_format = output_format, print_data = True )
98+ config_processor.process(
99+ path = path,
100+ filters = filters,
101+ exclude_keys = exclude_keys,
102+ output_format = output_format,
103+ print_data = True
104+ )
96105
97106```
98107
@@ -151,8 +160,9 @@ usage: himl [-h] [--output-file OUTPUT_FILE] [--format OUTPUT_FORMAT]
151160 [--filter FILTER] [--exclude EXCLUDE]
152161 [--skip-interpolation-validation]
153162 [--skip-interpolation-resolving] [--enclosing-key ENCLOSING_KEY]
154- [--cwd CWD]
163+ [--cwd CWD] [--multi-line-string]
155164 [--list-merge-strategy {append,override,prepend,append_unique}]
165+ [--allow-unicode]
156166 path
157167` ` `
158168
@@ -296,6 +306,63 @@ endpoint: "{{outputs.cluster_composition.output.value.redis_endpoint}}"
296306kubeconfig_location: "{{env(KUBECONFIG)}}"
297307` ` `
298308
309+ # ## Unicode Support
310+
311+ himl supports Unicode characters in configuration files, allowing you to use international languages, special characters, and emoji in your YAML configs.
312+
313+ By default, Unicode characters are escaped in the output to ensure compatibility. You can preserve Unicode characters in their original form using the `--allow-unicode` flag.
314+
315+ **Using the CLI:**
316+ ` ` ` sh
317+ # With Unicode escaping (default)
318+ himl examples/simple/production --output-file config.yaml
319+
320+ # Preserving Unicode characters
321+ himl examples/simple/production --output-file config.yaml --allow-unicode
322+ ` ` `
323+
324+ **Using the Python module:**
325+ ` ` ` py
326+ from himl import ConfigProcessor
327+
328+ config_processor = ConfigProcessor()
329+ path = "examples/simple/production"
330+
331+ # Process with Unicode preservation
332+ config = config_processor.process(
333+ path=path,
334+ output_format="yaml",
335+ allow_unicode=True, # Preserve Unicode characters
336+ print_data=True
337+ )
338+ ` ` `
339+
340+ **Example with Unicode content:**
341+
342+ `config/default.yaml` :
343+ ` ` ` yaml
344+ service:
345+ name: "My Service"
346+ description: "Multi-language support: English, 中文, العربية, Русский"
347+
348+ messages:
349+ welcome:
350+ en: "Welcome"
351+ zh: "欢迎"
352+ ar: "مرحبا"
353+ ru: "Добро пожаловать"
354+
355+ team:
356+ - name: "José García"
357+ role: "Developer"
358+ - name: "田中太郎"
359+ role: "Designer"
360+ ` ` `
361+
362+ When processed with `--allow-unicode`, the output preserves all Unicode characters. Without the flag, non-ASCII characters are escaped (e.g., `\u4e2d\u6587` for Chinese characters).
363+
364+ **Note:** Some emoji and 4-byte UTF-8 characters may be escaped by the YAML library even with `--allow-unicode` enabled.
365+
299366
300367# # himl-config-merger
301368
@@ -394,6 +461,12 @@ Build the output with filtering:
394461himl-config-merger examples/filters --output-dir merged_output --levels env region cluster --leaf-directories cluster --filter-rules-key _filters
395462```
396463
464+ The ` himl-config-merger ` command also supports the ` --allow-unicode ` flag for preserving Unicode characters in the merged output files:
465+
466+ ``` sh
467+ himl-config-merger examples/complex --output-dir merged_output --levels env region cluster --leaf-directories cluster --allow-unicode
468+ ```
469+
397470``` yaml
398471# output after filtering
399472env : dev
@@ -449,9 +522,14 @@ filters = () # can choose to output only specific keys
449522exclude_keys = () # can choose to remove specific keys
450523output_format = "yaml" # yaml/json
451524
452- config_processor.process(path=path, filters=filters, exclude_keys=exclude_keys,
453- output_format=output_format, print_data=True,
454- type_strategies= [(list, [strategy_merge_override,'append']), (dict, ["merge"])] ))
525+ config_processor.process(
526+ path=path,
527+ filters=filters,
528+ exclude_keys=exclude_keys,
529+ output_format=output_format,
530+ print_data=True,
531+ type_strategies=[(list, [strategy_merge_override, 'append']), (dict, ["merge"])]
532+ )
455533
456534` ` `
457535
0 commit comments