Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4422 closed Bug (fixed)

On Mac, tr_getWebClientDir() uses incorrect encoding for creating the web content dir path

Reported by: Benjamin Owned by: livings124
Priority: Normal Milestone: 2.40
Component: libtransmission Version: 2.33
Severity: Normal Keywords:
Cc:

Description

The code uses CFStringGetFastestEncoding() which does not always return a correct encoding when working with non-latin1 string (if the use uses a Asian username for example).

It should use CFStringGetFileSystemRepresentation() instead, which return string with the right encoding for system calls.

Attachments (1)

fix_weird_encoding.patch (1.5 KB) - added by Benjamin 5 years ago.
Patch

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by Benjamin

Patch

comment:1 Changed 5 years ago by livings124

  • Owner changed from jordan to livings124

comment:2 Changed 5 years ago by livings124

  • Milestone changed from None Set to 2.40
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from 2.33+ to 2.33

r12684 Thanks!

comment:3 Changed 5 years ago by Benjamin

There was a reason for the UNUSED in the original patch. Without it, you will get a "unused variable" warning when building in release since the variable is only used in an assertion...

comment:4 follow-up: Changed 5 years ago by livings124

It's not unused when building in released. A warning is better than marking a used variable unused.

Version 0, edited 5 years ago by livings124 (next)

comment:5 in reply to: ↑ 4 Changed 5 years ago by Benjamin

Replying to livings124:

A warning is better than marking a used variable unused.

How so?

I am used to so many projects building with -Werror, all those warnings are kind of scary for me :-D

comment:6 follow-up: Changed 5 years ago by livings124

The compiler can do weird things if you give it bad/wrong code. Warnings are harmless.

comment:7 in reply to: ↑ 6 Changed 5 years ago by Benjamin

Replying to livings124:

The compiler can do weird things if you give it bad/wrong code. Warnings are harmless.

hehe :-)

For some projects the policy is if the compiler and the static analyzer cannot assert what you do, then your code is not clear enough. No worries, I guess you just have a different culture in Transmission.

comment:8 Changed 5 years ago by livings124

Feel free to update the code to mark is unused when it is. My policy is I'd rather have right code than warning-free code. Notice I even add my own warnings as reminders through the code. :)

Note: See TracTickets for help on using tickets.