# Problems with strings which contain unicode characters on julia 0.7-DEV

**URL:** <https://discourse.julialang.org/t/problems-with-strings-which-contain-unicode-characters-on-julia-0-7-dev/6279>\
**Category:** General Usage\
**Created:** [October 6, 2017, 2:08am UTC](https://discourse.julialang.org/t/problems-with-strings-which-contain-unicode-characters-on-julia-0-7-dev/6279 "2017-10-06T02:08:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PerezHz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/perezhz/32/1750_2.png) [@PerezHz](https://discourse.julialang.org/u/PerezHz)\
**Post date:** [October 6, 2017, 2:08am UTC](https://discourse.julialang.org/t/problems-with-strings-which-contain-unicode-characters-on-julia-0-7-dev/6279/1 "2017-10-06T02:08:17Z")

</div>

Hi everyone! Is this a known issue on julia 0.7-DEV?

```julia-repl
julia> str1 = "a "
"a "

julia> str2 = "a"
"a"

julia> str2 == str1[1:end-1]
true

julia> str1 = "₁ "
"₁ "

julia> str2 = "₁"
"₁"

julia> str2 == str1[1:end-1]
ERROR: UnicodeError: invalid character index
Stacktrace:
 [1] getindex(::String, ::UnitRange{Int64}) at ./strings/string.jl:292

```

My system is OS X 10.10.5; julia version is 0.7.0-DEV.2046 (commit 16139d0, 1 day old master). 0.6 doesn’t seem to have this problem.

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [October 6, 2017, 2:11am UTC](https://discourse.julialang.org/t/problems-with-strings-which-contain-unicode-characters-on-julia-0-7-dev/6279/2 "2017-10-06T02:11:48Z")

</div>

Yes, it was decided to only allow valid codepoints in string indexing, use

```julia
str1[1:prevind(str1, end)]

```

It’s documented in the breaking changes section: [https://github.com/JuliaLang/julia/blob/master/NEWS.md#breaking-changes](https://github.com/JuliaLang/julia/blob/master/NEWS.md#breaking-changes)

---

<div class="post-metadata">

**Author:** ![PerezHz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/perezhz/32/1750_2.png) [@PerezHz](https://discourse.julialang.org/u/PerezHz)\
**Post date:** [October 6, 2017, 3:31am UTC](https://discourse.julialang.org/t/problems-with-strings-which-contain-unicode-characters-on-julia-0-7-dev/6279/3 "2017-10-06T03:31:44Z")

</div>

Many thanks, @Keno!
