{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/5524","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/5524/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/5524/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/5524/events","html_url":"https://github.com/dotnet/roslyn/issues/5524","id":108830229,"number":5524,"title":"Encapsulate Field refactoring can result in incorrect case conversions depending on the user's locale","user":{"login":"pkanavos","id":847387,"avatar_url":"https://avatars.githubusercontent.com/u/847387?v=3","gravatar_id":"","url":"https://api.github.com/users/pkanavos","html_url":"https://github.com/pkanavos","followers_url":"https://api.github.com/users/pkanavos/followers","following_url":"https://api.github.com/users/pkanavos/following{/other_user}","gists_url":"https://api.github.com/users/pkanavos/gists{/gist_id}","starred_url":"https://api.github.com/users/pkanavos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkanavos/subscriptions","organizations_url":"https://api.github.com/users/pkanavos/orgs","repos_url":"https://api.github.com/users/pkanavos/repos","events_url":"https://api.github.com/users/pkanavos/events{/privacy}","received_events_url":"https://api.github.com/users/pkanavos/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-IDE","name":"Area-IDE","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Localization","name":"Localization","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"rchande","id":3751401,"avatar_url":"https://avatars.githubusercontent.com/u/3751401?v=3","gravatar_id":"","url":"https://api.github.com/users/rchande","html_url":"https://github.com/rchande","followers_url":"https://api.github.com/users/rchande/followers","following_url":"https://api.github.com/users/rchande/following{/other_user}","gists_url":"https://api.github.com/users/rchande/gists{/gist_id}","starred_url":"https://api.github.com/users/rchande/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchande/subscriptions","organizations_url":"https://api.github.com/users/rchande/orgs","repos_url":"https://api.github.com/users/rchande/repos","events_url":"https://api.github.com/users/rchande/events{/privacy}","received_events_url":"https://api.github.com/users/rchande/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/3","html_url":"https://github.com/dotnet/roslyn/milestones/1.1","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/3/labels","id":937401,"number":3,"title":"1.1","description":"This is our 1.1 Milestone.\r\n\r\n<!---\r\n@huboard:{\"order\":1.5}\r\n-->\r\n","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":267,"closed_issues":500,"state":"open","created_at":"2015-01-15T20:48:41Z","updated_at":"2015-10-06T06:11:32Z","due_on":null,"closed_at":null},"comments":16,"created_at":"2015-09-29T09:24:30Z","updated_at":"2015-10-06T08:46:21Z","closed_at":null,"body":"As shown in [this SO question](http://stackoverflow.com/questions/32825792/visual-studio-2015-encapsulate-field/32825978), applying the Encapsulate field on a field starting with `i`, eg `inside`, results in a property named `İnside` instead of `Inside` if the user's locale is set to Turkish. \r\n\r\nThis is caused because [AbstractEncapsulateFieldService.GeneratePropertyName](https://github.com/dotnet/roslyn/blob/de252f4feb10428bdf4bcbeebc73a8deb19af3c5/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs#L362) makes a call to `char.ToUpper()` without specifying the invariant culture. As a result, the case conversion is culture-specific, using the current user's locale. The case of the Turkish `i` is even described in the MSDN Article [Writing Culture-Safe Managed Code](https://msdn.microsoft.com/en-us/library/ms994325.aspx#cltsafcode_topic4). \r\n\r\nThe fix should be to change line 362 to pass `CultureInfo.InvariantCulture` to `ToUpper()`, eg:\r\n\r\n    return char.ToUpper(baseName[0],CultureInfo.InvariantCulture).ToString() + baseName.Substring(1);\r\n\r\ninstead of :\r\n\r\n    return char.ToUpper(baseName[0]).ToString() + baseName.Substring(1);\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/145786751","html_url":"https://github.com/dotnet/roslyn/issues/5524#issuecomment-145786751","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/5524","id":145786751,"user":{"login":"yunyilmaz","id":10562771,"avatar_url":"https://avatars.githubusercontent.com/u/10562771?v=3","gravatar_id":"","url":"https://api.github.com/users/yunyilmaz","html_url":"https://github.com/yunyilmaz","followers_url":"https://api.github.com/users/yunyilmaz/followers","following_url":"https://api.github.com/users/yunyilmaz/following{/other_user}","gists_url":"https://api.github.com/users/yunyilmaz/gists{/gist_id}","starred_url":"https://api.github.com/users/yunyilmaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunyilmaz/subscriptions","organizations_url":"https://api.github.com/users/yunyilmaz/orgs","repos_url":"https://api.github.com/users/yunyilmaz/repos","events_url":"https://api.github.com/users/yunyilmaz/events{/privacy}","received_events_url":"https://api.github.com/users/yunyilmaz/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T08:46:21Z","updated_at":"2015-10-06T08:46:21Z","body":"@davkean Yes I think it should match. Because Upper version of **i** is **İ** . But to provide this kind of functionality is not a trival task. Lets say you press little **i** key You checked Index(en) but not Irak(tr) I don't think it is possible for IDE to know Irak is a turkish word."}}