{"action":"created","issue":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/3059","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/3059/labels{/name}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/3059/comments","events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/3059/events","html_url":"https://github.com/qbittorrent/qBittorrent/issues/3059","id":78186314,"number":3059,"title":"MSVC2013 complains Unicode format","user":{"login":"Chocobo1","id":9395168,"avatar_url":"https://avatars.githubusercontent.com/u/9395168?v=3","gravatar_id":"","url":"https://api.github.com/users/Chocobo1","html_url":"https://github.com/Chocobo1","followers_url":"https://api.github.com/users/Chocobo1/followers","following_url":"https://api.github.com/users/Chocobo1/following{/other_user}","gists_url":"https://api.github.com/users/Chocobo1/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobo1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobo1/subscriptions","organizations_url":"https://api.github.com/users/Chocobo1/orgs","repos_url":"https://api.github.com/users/Chocobo1/repos","events_url":"https://api.github.com/users/Chocobo1/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobo1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-05-19T17:44:49Z","updated_at":"2016-01-16T17:36:56Z","closed_at":"2015-06-28T13:12:50Z","body":"Compiling in Windows with MSVC2013.\r\n```\r\ncore\\misc.cpp : warning C4819: The file contains a character that cannot be represented in the current code page (950).\r\nSave the file in Unicode format to prevent data loss\r\n... cut ...\r\ncore\\misc.cpp(408) : error C2001: newline in constant\r\ncore\\misc.cpp(409) : error C2143: syntax error : missing ')' before 'if'\r\ncore\\misc.cpp(424) : error C2001: newline in constant\r\ncore\\misc.cpp(425) : error C2143: syntax error : missing ')' before '}'\r\n```\r\nIt is caused by the unicode infinity character [`∞`](http://unicode-table.com/en/221E/) (there are more similar errors in other files). \r\nThe source file (misc.cpp) is encoded in \"UTF8 without BOM\" (which MSVC doesn't like to handle, see [MSDN](https://msdn.microsoft.com/en-us/library/xwy0e8f2.aspx)).\r\n\r\nCurrently, I can think of 2 solutions (tested, all compiles without warnings in linux):\r\n  1. Keep the unicode character but resave those affected files in \"UTF8 with BOM\".\r\nIMO, we might lost the BOM easily when saving in different OS/editors...\r\n  UPDATE: Also needs to add `#pragma execution_character_set(\"utf-8\")` in the affected file.\r\n\r\n  2. Keep saving in \"UTF8 without BOM\" but change unicode characters into unicode escape sequences, like `\"∞\"` -> `\"\\u221E\"`.\r\nNote that in this case, all unicode characters should be exterminated and cannot exist even in comment.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/comments/172234384","html_url":"https://github.com/qbittorrent/qBittorrent/issues/3059#issuecomment-172234384","issue_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/3059","id":172234384,"user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"created_at":"2016-01-16T17:36:56Z","updated_at":"2016-01-16T17:36:56Z","body":">@glassez I've misunderstood what the problem is?\r\nI've read all the posts and I very well understand what the problem is.\r\nMSVC compiler does not accept UTF8 literal strings\r\n\r\nMSVC compiler does not accept UTF8 <del>literal strings</del> characters in source files (even in comments, etc.), unless these files have BOM (the problem appears only on some configurations/locales)! But UTF8 BOM it's a complete perversion and we don't want to add it in our sources.\r\n```c++\r\ncase QLocale::Serbian: return QString::fromWCharArray(L\"Српски\");\r\n```\r\nThis will only work if the sources is UTF16 encoded (and if you use MSVC compiler). But in this case sources will be twice larger. I don't think it's a decent solution. But this is the smallest problem. I quote what you wrote above (but, apparently, you did not understand it correctly):\r\n>```wchar_t``` is a standard C++ built-in type whose character width depends on the compiler used.\r\n\r\nAFAIK, gcc **whar_t** is 32 bit! So it is obviously not suitable for use with string literals, if we want to have cross-platform sources."}}