umlauts doesnt work #2272

Closed
opened 2025-12-29 17:24:24 +01:00 by adam · 1 comment
Owner

Originally created by @tb-killa on GitHub (Jan 9, 2019).

Environment

  • Python version: 3.6
  • NetBox version: 2.5.2

Steps to Reproduce

Go to: Organization
Submenu: Tenants
Klick "Add" on top right.

Inside "Name" paste "öäüÖÄÜ"

Expected Behavior

The Input umlauts should be parsed in the "Slug" Input field like this:
oeaeueOeAeUe

Observed Behavior

Nothing: The Slug is empty. If someones Name is with umlauts the specific alphabetic character is missing.

Originally created by @tb-killa on GitHub (Jan 9, 2019). ### Environment * Python version: 3.6 * NetBox version: 2.5.2 ### Steps to Reproduce Go to: Organization Submenu: Tenants Klick "Add" on top right. Inside "Name" paste "öäüÖÄÜ" ### Expected Behavior The Input umlauts should be parsed in the "Slug" Input field like this: oeaeueOeAeUe ### Observed Behavior Nothing: The Slug is empty. If someones Name is with umlauts the specific alphabetic character is missing.
adam closed this issue 2025-12-29 17:24:24 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 9, 2019):

This is expected behavior. Those characters are removed because they aren't matched by the regex \w pattern. The slugify convenience function (below) doesn't perform arbitrary character substitution, but you can always modify the slug manually.

function slugify(s, num_chars) {
    s = s.replace(/[^\-\.\w\s]/g, '');          // Remove unneeded chars
    s = s.replace(/^[\s\.]+|[\s\.]+$/g, '');    // Trim leading/trailing spaces
    s = s.replace(/[\-\.\s]+/g, '-');           // Convert spaces and decimals to hyphens
    s = s.toLowerCase();                        // Convert to lowercase
    return s.substring(0, num_chars);           // Trim to first num_chars chars
}
@jeremystretch commented on GitHub (Jan 9, 2019): This is expected behavior. Those characters are removed because they aren't matched by the regex `\w` pattern. The slugify convenience function (below) doesn't perform arbitrary character substitution, but you can always modify the slug manually. ``` function slugify(s, num_chars) { s = s.replace(/[^\-\.\w\s]/g, ''); // Remove unneeded chars s = s.replace(/^[\s\.]+|[\s\.]+$/g, ''); // Trim leading/trailing spaces s = s.replace(/[\-\.\s]+/g, '-'); // Convert spaces and decimals to hyphens s = s.toLowerCase(); // Convert to lowercase return s.substring(0, num_chars); // Trim to first num_chars chars } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2272