You can use Unicode field names in Jira IQL queries, but it requires a bit of care and understanding of how Jira handles them. Here's a breakdown of how to do it, along with potential issues and workarounds:
Understanding the Problem
- Jira's Internal Representation: Jira internally often stores field names in a way that might not directly match the Unicode characters you see in the UI. This can lead to IQL queries failing if you directly use the Unicode characters.
- Encoding Issues: The encoding of your IQL query itself can be a factor. If your query isn't using UTF-8 encoding, the Unicode characters might be misinterpreted.
- Jira Version: Support for Unicode field names in IQL has improved over Jira versions. Older versions might be more problematic.
How to Use Unicode Field Names in IQL
-
Use the Field ID (Recommended): This is the most reliable method. Instead of using the display name (which might be Unicode), use the internal field ID.
-
How to find the Field ID:
- REST API: The best way is to use the Jira REST API. You can get a list of all fields and their IDs using the following endpoint:
GET /rest/api/3/field
(Replace /3/ with /2/ if you're on an older Jira version). The response will be a JSON array containing field objects, each with an id property. This id is what you need.
- Jira Administration (Limited): In some Jira versions, you can find the field ID in the custom field configuration. However, this isn't always readily available.
- Developer Tools (Browser): Inspect the network requests when you're editing a Jira issue. The field IDs are often used in the JSON payloads.
-
Example: Let's say you have a custom field with the Unicode display name "Приоритет" (Priority in Russian). The REST API might tell you its ID is customfield_10001. Your IQL query would then use:
customfield_10001 = "High"
-
Escape Unicode Characters (If you must use the display name): If you absolutely need to use the display name (not recommended), you might need to escape the Unicode characters. This is less reliable and can be version-dependent.
-
URL Encoding: Try URL encoding the Unicode characters. For example, "Приоритет" might become %D0%9F%D1%80%D0%B8%D0%BE%D1%80%D0%B8%D1%82%D0%B5%D1%82. Your IQL query would then look like:
"Приоритет" = "High" // This might work, but is unreliable
-
Unicode Escape Sequences (Less Common): You could try using Unicode escape sequences (e.g., \u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442). However, Jira's IQL parser might not support these directly.
-
Use the Field Name as it Appears in the UI (Sometimes Works): In some cases, Jira might correctly interpret the Unicode field name if you use it exactly as it appears in the UI. However, this is the least reliable method.
Important Considerations and Troubleshooting
- UTF-8 Encoding: Ensure your IQL query is saved and submitted using UTF-8 encoding. This is crucial for handling Unicode characters correctly. Most text editors and IDEs allow you to specify the encoding.
- Jira Version: Test your queries thoroughly in your specific Jira version. Behavior can change between versions.
- Case Sensitivity: IQL is generally case-insensitive for field names, but it's best to match the case exactly as it appears in the REST API response.
- Quotes: If the field name contains spaces or special characters, enclose it in double quotes.
- Error Messages: Pay close attention to the error messages Jira returns. They can provide clues about what's going wrong. Common errors include:
"Field '...' does not exist": This usually means you're using the wrong field name or ID.
"Invalid IQL syntax": This could be due to incorrect escaping or encoding.
- Jira Cloud vs. Server/Data Center: Jira Cloud generally has better Unicode support than older Jira Server/Data Center versions.
- Testing: Start with simple queries to verify that Jira can recognize the field name. Then, gradually add more complex conditions.
Example Scenario
Let's say you have a custom field named "Ответственный" (Responsible in Russian) with the ID customfield_10002. You want to find all issues where the "Ответственный" field is set to "John Doe".
Correct IQL Query (using Field ID):
customfield_10002 = "John Doe"
Incorrect IQL Query (using Unicode display name - likely to fail):
"Ответственный" = "John Doe"
In summary, always prioritize using the field ID obtained from the Jira REST API. It's the most reliable and future-proof way to work with Unicode field names in IQL queries. If you must use the display name, be prepared for potential issues and test thoroughly. Ensure your query is UTF-8 encoded.